|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Trigger action
[Re: xXxGuitar511]
#116175
03/10/07 08:16
03/10/07 08:16
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
I'm trying to understand how the script works. I don't understand the line; 'if (!my.skill11 & my.skill10)' Can you explain it to me (I see only one &)?
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
Re: Trigger action
[Re: Frits]
#116176
03/10/07 08:38
03/10/07 08:38
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
I trimmed it down with boolean operators. Basically, it's this:
if ((my.skill11 == 0) & (my.skill10 == 1))
skill10 = [is inside trigger] skill11 = [was inside trigger last frame]
so:
if ([wasn't in range] & [is in range]) { then you know you've just entered the trigger }
xXxGuitar511 - Programmer
|
|
|
Re: Trigger action
[Re: xXxGuitar511]
#116177
03/10/07 09:00
03/10/07 09:00
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
Thanks for your explanation. I thought that you had to use && for the AND operator.
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
Re: Trigger action
[Re: Ottawa]
#116179
03/11/07 18:25
03/11/07 18:25
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
& is shorthand for &&...  actually, there is a difference, but not really an important one. if using &, then then engine will compare both statements. If using &&, then the engine only checks the second statement if the first one returns true. So, technically && is better, and will increase your speed if using a complex calculation inside the if statement.
xXxGuitar511 - Programmer
|
|
|
Re: Trigger action
[Re: Frits]
#116181
03/12/07 18:32
03/12/07 18:32
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
Quote:
If using &&, then the engine only checks the second statement if the first one returns true.
Quoted xXxGuitar511. What's your source on that? Actually, tests seemed to indicate that logical operators in C-Script do not short-circuit. However, logical operators might short-circuit in Lite-C.
Quote:
& is shorthand for &&...
Quoted xXxGuitar511. Well...
x = 6 & 4; // x = 4 x = (6 && 4); // x = 1
|
|
|
Re: Trigger action
[Re: testDummy]
#116182
03/13/07 13:21
03/13/07 13:21
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Hmm... not sure. I thought it was in the manual. I must have seen that somewhere else. Well, since I can't prove it, I'm not sure what the difference is, as testdummy's results are interesting.
I guess I'll have to do some testing myself, if I find time. Did using parenthesis make a difference, as I only see them on your secong result?
xXxGuitar511 - Programmer
|
|
|
|