Senior Member
Join Date: Nov 2009
Posts: 891
|
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. Evil wins because good rolls poorly .... or the players are not paying enough attention to the game. |
#1 |
Senior Member
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819
|
What if you did something like:
Code:
if (compare(lowercase(field[usrChosen1].chosen.field[name].text),"zombie") = 0 then Lenny Zimmermann Metairie, LA, USA Data files authored (please let me know if you see any issues with any of these if you have/use them): Official (In the downloader) 50 Fathoms, Deadlands: Hell On Earth, Deadlands: Noir, East Texas University, Necessary Evil (requires Super Powers Companion), Pirates of the Spanish Main, Space 1889 (original file by Erich), Tour of Darkness, Weird War II, Weird Wars: Rome Coming Eventually Evernight (LWD has completed their review but I have some fixes to make first... although Pinnacle mentioned this might get an overhaul to SWADE so I may just wait for that first. If you just HAVE to have this now, though, just PM me) |
#2 |
Senior Member
Join Date: Nov 2009
Posts: 891
|
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. Evil wins because good rolls poorly .... or the players are not paying enough attention to the game. |
#3 |
Senior Member
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819
|
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.
Lenny Zimmermann Metairie, LA, USA Data files authored (please let me know if you see any issues with any of these if you have/use them): Official (In the downloader) 50 Fathoms, Deadlands: Hell On Earth, Deadlands: Noir, East Texas University, Necessary Evil (requires Super Powers Companion), Pirates of the Spanish Main, Space 1889 (original file by Erich), Tour of Darkness, Weird War II, Weird Wars: Rome Coming Eventually Evernight (LWD has completed their review but I have some fixes to make first... although Pinnacle mentioned this might get an overhaul to SWADE so I may just wait for that first. If you just HAVE to have this now, though, just PM me) |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
What is your objective? I'm having trouble understanding your original question - I'm not sure what it is you're trying to accomplish.
|
#5 |
Senior Member
Join Date: Nov 2009
Posts: 891
|
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 Code:
rank = field[usrChosen1].chosen.tagvalue[MinRank.?] 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. Evil wins because good rolls poorly .... or the players are not paying enough attention to the game. |
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Code:
if (field[usrChosen1].chosen.tagis[Power.powZombie] <> 0) then |
#7 |
Senior Member
Join Date: Nov 2009
Posts: 891
|
Awesome, thanks. So simple and obvious now.
I was close on one of my attempts (not shared above) but not quite right. Evil wins because good rolls poorly .... or the players are not paying enough attention to the game. |
#8 |
|
|