Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by jcl. 04/24/26 17:48
ZorroGPT
by TipmyPip. 04/23/26 14:23
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 3,176 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Trigger action [Re: xXxGuitar511] #116175
03/10/07 08:16
03/10/07 08:16
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline 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 Offline
Expert
xXxGuitar511  Offline
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 Offline OP
User
Frits  Offline 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: xXxGuitar511] #116178
03/10/07 23:49
03/10/07 23:49
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Thanks xXxGuitar511 I'll look at that.


Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
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 Offline
Expert
xXxGuitar511  Offline
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: xXxGuitar511] #116180
03/12/07 08:31
03/12/07 08:31
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Ok, thanks again.


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Trigger action [Re: Frits] #116181
03/12/07 18:32
03/12/07 18:32
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

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 Offline
Expert
xXxGuitar511  Offline
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
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1