(try_begin),
(eq, ":this", 1),
(neq, ":wookie_is_stupid", 2),
do this
do this
(else_try),
(eq, ":this", 2),
(eq, ":wookie_is_stupid", 1),
do this instead
(else_try),
do this
(try_end),
WookieWarlord said:Hmmmm.
It's like an 'if' statement, if all the conditions after (try_begin), are true, it will do the actions after it (you can use else_try as well).
Code:(try_begin), (eq, ":this", 1), (neq, ":wookie_is_stupid", 2), do this do this (else_try), (eq, ":this", 2), (eq, ":wookie_is_stupid", 1), do this instead (else_try), do this (try_end),
The last part means if none of the 'try sections' meets the condition, do this instead.
I hope this helps at all?
if (condition) {
action }
(try_begin),
condition
action
(try_end),
WookieWarlord said:Yea I see how it could be confusing at first.
Instead of:
It is:Code:if (condition) { action }
If you don't meet the condition it will just skip to below the (try_end),.Code:(try_begin), condition action (try_end),
(try_begin),
condition1
condition2
condition3
action1
action2
(try_end), OR ELSE_TRY!
Chris_B said:This has been bugging me for a while now and, based on what I've tried and seen in the module system, I haven't been able to figure it out on my own.![]()
I also haven't been able to find anything that explains this type of thing in any guides.
How exactly do the equality tests get handled? I've seen some stuff in the module system that, based on my experience and knowledge, seems to suggest one thing but in fact works in an opposite manner.
Does a check, for instance (eq, ":foo", ":bar"), that evaluates to false mean that nothing below it in the same scope, within the same (try_begin) (try_end), or whatever, will work?
Code:("example", [ (eq, ":foo", ":bar"), # assume evaluates to false ... bunch of stuff down here ... # none of this gets looked at, regardless of what it is, because the check above was false? ] ),
Is it only the next check/instruction?
Code:("example", [ (eq, ":foo", ":bar"), # assume evaluates to false ... do one thing here ... # doesn't get done because above check is false ... bunch of stuff down here ... # this does gets looked at, even though that initial check was false? ] ),
Also, what determines whether to use the (else_try) block in a (try_begin), (else_try), (try_end) setup? How does the engine decide when it's appropriate to jump out of the initial (try_begin) block and take a look in the (else_try)? Assuming the second example above is what is indeed happening.
Caba`drin said:Chris_B, equality tests work as you demonstrate in "Example Script 1."
So, the usefulness of try blocks is you can have an equality test with a set of things to be done depending on the result of the test, but then after the (try_end), the script will continue regardless of the test.
Code:("example", [ (agent_is_alive), # unless true, nothing below happens (try_begin), (eq, ":foo", ":bar"), # assume evaluates to false ... bunch of stuff down here ... # none of this gets looked at, regardless of what it is, because the check above was false. (try_end), ... bunch more stuff # this does get looked at, regardless of the eq test of foo-bar, but only if the agent is alive ] ),
CTCCoco said:Thanks for all, now I know how conditions work but what means this?
(eq, "$g_mt_mode", ctm_melee),
(assign, ":total_difficulty", 0),
(try_for_range, ":i", 0, ":training_param"),
Thanks Wookie! I will start do something now!WookieWarlord said:I believe you are talking about scene props. You can add triggers to them that activate at such times as they 'initialise', are 'hit', are 'destroyed' or 'on use' (f button).
They are actually pretty darn useful!
WookieWarlord said:I believe you are talking about scene props. You can add triggers to them that activate at such times as they 'initialise', are 'hit', are 'destroyed' or 'on use' (fE button).
They are actually pretty darn useful!