Beaten by a global variable...
Posted: Fri Sep 25, 2015 4:13 pm
Hi, I have a situation where I want to pass a value between cards in the same stack, so I used a global to do it, but the value of the global doesn't seem to be recognised and I'm confused about why...
My global is named gVidModule, in the target card script it's declared as a global and it carries the value through as it should - so if, in the first card, I give it the value "pirate001" I see that value is present in the debugger (so far so good).
In the target script I want to check if "pirate001" is one of the list items in a variable called strBoughtItems. In the debugger, I see strBoughtItems is populated as I expect. Then I hit this code and it all goes wonky...
Even though the debugger shows the following:
gVidModule has the value pirate001
strBoughtItems has the value item1,item2,item3,pirate001,item5
If I set the value of gVidModule directly before the condition is reached i.e. the condition is met as I expect it to be, but ordinarily, it is not.
I'm clearly missing something, but can someone help me out with what it is?
Regards
Chris
My global is named gVidModule, in the target card script it's declared as a global and it carries the value through as it should - so if, in the first card, I give it the value "pirate001" I see that value is present in the debugger (so far so good).
In the target script I want to check if "pirate001" is one of the list items in a variable called strBoughtItems. In the debugger, I see strBoughtItems is populated as I expect. Then I hit this code and it all goes wonky...
Code: Select all
if gVidModule is among the items of strBoughtItems then
answer( "Video is owned" )
end if
gVidModule has the value pirate001
strBoughtItems has the value item1,item2,item3,pirate001,item5
If I set the value of gVidModule directly before the condition is reached i.e.
Code: Select all
put "pirate001" into gVidModule
I'm clearly missing something, but can someone help me out with what it is?
Regards
Chris