Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Savage Worlds
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
SeeleyOne
Senior Member
 
Join Date: Nov 2009
Posts: 891

Old December 6th, 2014, 11:04 PM
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.
SeeleyOne is offline   #1 Reply With Quote
zarlor
Senior Member
 
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819

Old December 7th, 2014, 03:42 AM
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.

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)
zarlor is offline   #2 Reply With Quote
SeeleyOne
Senior Member
 
Join Date: Nov 2009
Posts: 891

Old December 7th, 2014, 10:06 AM
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.
SeeleyOne is offline   #3 Reply With Quote
zarlor
Senior Member
 
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819

Old December 8th, 2014, 04:35 AM
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)
zarlor is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old December 10th, 2014, 09:16 PM
What is your objective? I'm having trouble understanding your original question - I'm not sure what it is you're trying to accomplish.
Mathias is online now   #5 Reply With Quote
SeeleyOne
Senior Member
 
Join Date: Nov 2009
Posts: 891

Old December 10th, 2014, 10:10 PM
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.

Evil wins because good rolls poorly .... or the players are not paying enough attention to the game.
SeeleyOne is offline   #6 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old December 11th, 2014, 08:21 AM
Code:
if (field[usrChosen1].chosen.tagis[Power.powZombie] <> 0) then
Mathias is online now   #7 Reply With Quote
SeeleyOne
Senior Member
 
Join Date: Nov 2009
Posts: 891

Old December 11th, 2014, 09:53 AM
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.
SeeleyOne is offline   #8 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:48 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.