• 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

Comparison of User Choice

SeeleyOne

Well-known member
There are a few methods to get a string for the value pf the User Selection choice in an edge.

For example, if you want the name it is
powerName = field[usrChosen1].chosen.field[name].text

If you want the id of a Power, it is
powerID = field[usrChosen1].chosen.tagids[Power.?]

But what I cannot figure out is how to use them in a comparison statement. For example, let's say that I want to have an if statement for if the power has the Zombie name, or perhaps Power.powZombie id. A simple if statement with an = does not work, or at least I could not get it to do so. These print as strings if they are placed into a string, but I cannot get them to compare.

Is there a special syntax to compare a string to another value? Something like if (powerID = "Power.powZombie") or (powerName = "Zombie"). These give an error to one of the sides of the comparison equation. Are these actually using arrays instead?

After I figure this out, I plan to have be able to compare against the userChosen1 of other edges that also have a userChosen1.
 
What if you did something like:
Code:
if (compare(lowercase(field[usrChosen1].chosen.field[name].text),"zombie") = 0 then

That's just using one of the examples I know works for doing string comparisons for Knowledge skills but I've no idea if it will translate for what you're trying to do here, mind you.
 
That works for things like rendering the No Power Points values, but in this case it gave an error "Attempt to access pick information or behaviors for read-only thing 'powZombie'
Location: 'eval' script for Thing 'edgnewpwr' (Eval Script '#1') near line 35"

It does this even if I use a string in place of the
field[usrChosen1].chosen.field[name].text
The usrChosen1 is probably a pointer to the original object, in this case the zombie power. If that is the case I just need to figure out the pointer syntax.
 
I have no clue on that, then. Sounds more like a CapedCrusader or Mathias question when one of them gets a chance to check in here.
 
What is your objective? I'm having trouble understanding your original question - I'm not sure what it is you're trying to accomplish.
 
I want to be able to make an if statement that compares the name of a power that is chosen using the user chosen field within and edge. Basically, you pick an edge, and that edge has a field to select from the list of powers (in my case component.Power). Then after picking the power, it can compare to see if it is a particular power. In the above example it is the zombie power.

I can find out the name with this:
Code:
powerName = field[usrChosen1].chosen.field[name].text

And, for the sake of reference (and not part of the dilemma) it can find out the rank like this:
Code:
rank = field[usrChosen1].chosen.tagvalue[MinRank.?]

The problem that I am having is that while it will print out the name just fine, I have not figured out how to compare that name to anything. In theory it would be a string as that is what the powerName is, but field[usrChosen1].chosen is an object, or more likely a pointer to an object.

So, how would I compare powerName to something like "Zombie"? I want it to be able to interact with other edges such as the Necromancer edge, but I need to be able to do an if statement that compares the powerName.
 
Awesome, thanks. So simple and obvious now.

I was close on one of my attempts (not shared above) but not quite right.
 
Back
Top