Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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 | chip programmers | 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