Jump to content
Sign in to follow this  
Owuor

Variable confusion

Recommended Posts

OK, I'm making my first foray into using variables.

I have two scripts that run when certain conditions have been met. What I want to do is to run a trigger once both of these scripts have been run. I was thinking I could do it with variables.

I am not having any luck though.

Initially I want the variable testvar to equal 0

At the end of each script can i do something like

testvar = testvar + 1

and have my trigger activate on the condition

testvar = 2

or do variables only work on true-false?

Any help would be appreciated.

I found the Editing Tutorial on the OFP disk more than a little skimpy with how it dealt with variables.

Share this post


Link to post
Share on other sites

Hi,

it seems you simply got the activation condition wrong. To test if two things are equal, you have to use "==" instead of "=" (which is only used of assignment).

So, put this in the condition field of the trigger,

testvar == 2

and it should work.

Spinor

Share this post


Link to post
Share on other sites

yes, you can use variable=variable+1 but if you want to check for the variable's numerical value you'll have to use "=="

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (variable==2)<span id='postcolor'>

you could also use 2 different variables set to true of false

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">variable1 = true AND variable2 = true<span id='postcolor'>

Share this post


Link to post
Share on other sites

Thank you both! I sucessfully tried it both ways, with the == and using two variables with true/false as well.

Much appreciated! smile.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×