• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Getting a name string

Mergon

Well-known member
Ok, on an adjustment I have it set up on pChosen2 to selected a Damage Resistance from the drop down. No problem. But how do you get the name of the selected item?

I've tried the following:
field[pChosen2].chosen.field[livename].text
field[pChosen2].chosen.field[thingname].text

Is there way to get the name off the DamageRes.? where the ? is the element selected (i.e.; dtFire would give Fire)?

The adjustment I'm trying to create is on a cantrip Makeshift Wand. This cantrip turns a small, 1-handed , holdable item into a wand. The item can then fire a single bolt of elemental damage based on the choice you have made.

Basically the item's livename should look something like this:

Makeshift wand (2d6 fire damage).

What I keep getting is:

Makeshift wand (2d6 ???? damage). :confused:

Eval script Render, Priority: 10000

~ If we're not enabled, get out now
doneif (field[pIsOn].value = 0)
~ If nothing's been chosen, get out now
doneif (field[pChosen].ischosen = 0)
~ If nothing's been chosen, get out now
doneif (field[pChosen2].ischosen = 0)

var iHD as number
var iDice as number
var sText as string
var sElement as string
iHD = #totallevelcount[]

if (iHD >= 17) then
iDice = 4
elseif (iHD >= 11) then
iDice = 3
elseif (iHD >= 5) then
iDice = 2
else
iDice = 1
endif

sElement = field[pChosen2].chosen.field[thingname].text
~sElement = right (sElement, length (sElement)-2)

sText = iDice & "d8 " & sElement & " damage."

field[pChosen].chosen.field[DescAppend].text = sText

field[pChosen].chosen.field[livename].text = "Makeshift wand (" & field[pChosen].chosen.field[thingname].text & ", " & sText & ")"
 
I've tried the following:
field[pChosen2].chosen.field[livename].text
field[pChosen2].chosen.field[thingname].text
As they are Things you may need to use field[name].text


Is there way to get the name off the DamageRes.? where the ? is the element selected (i.e.; dtFire would give Fire)?
tagnames[DamageRes.?] if you have multiple tags you will get multiple names.

But if this is a "thing" I am not 100% sure tagnames will work actually...
 
field[name].text

^^ Did the trick, many thanks. Not a field name I knew of. Added to my list of references. :)
 
Back
Top