Gamestudio Links
Zorro Links
Newest Posts
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Max Number of Strategies in /Strategy folder
by Martin_HH. 06/12/26 08:50
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
Z9 getting Error 058
by k_ivan. 06/10/26 14:38
ZorroGPT
by TipmyPip. 06/10/26 13:07
Z12 live performance
by alx. 06/09/26 20:42
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 2,164 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Negation Comparision expression not working in Lite-C?!?!? #370405
05/13/11 04:15
05/13/11 04:15
Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Ericmor Offline OP
Member
Ericmor  Offline OP
Member

Joined: Apr 2007
Posts: 125
Brazil - São Paulo
I´m translating a large old .wdl project to Lite-C.
I´ve received the following error in my last attempt:

Error in ´actions.c´ line 763:
syntax error
< if!(player_A.frame>=91&&player_A.frame<=97)||player_A.frame<=90&&onfloor==0)
>

After some struggle, i noticed that the engine would accept the expression if i removed the "!" negation comparision symbol from it.
Just to be sure, i found the following example on the manual:

Code:
!((10 <= x) && (15 => x)) // true if x is less than 10 or greater than 15 (lite-C only)



Then, i added it to my code, just replacing the 'x' for 'my.x'...

Code:
if !((10 <= my.x) && (15 => my.x)) {wait(1);}



...wich generates the following error:

Error in 'actions.c' line 763:
syntax error
< if !((10<=my.x) && (15=>my.x)) {wait(1);}

>

If a code from the MANUAL, wich is specifically meant to be used in Lite-C, is generating errors, i could only guess that´s a manual mistake.
I was unable to find any correct syntax for the expression so far anywhere in the manual... please help.
Thanks in advance.

Re: Negation Comparision expression not working in Lite-C?!?!? [Re: Ericmor] #370406
05/13/11 04:52
05/13/11 04:52
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hey again :D, you have to move the ! operator inside the if(..) clause...

if (!((10 <= my.x) && (15 => my.x))) {wait(1);}

The ! operator has higher precedence than the && operator, so we enclose the inner statement in parenthesis ( ) and then negate the whole expression.

Re: Negation Comparision expression not working in Lite-C?!?!? [Re: DJBMASTER] #370413
05/13/11 07:11
05/13/11 07:11
Joined: Sep 2003
Posts: 938
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 938
You seem to have often problems with your project translation, this could be because of not knowing the lite-C syntax. For transferring a large WDL script to C, you should know the syntax or else the translating wont be much fun. The Sam's Learning C in 21 days tutorial is very good.

Re: Negation Comparision expression not working in Lite-C?!?!? [Re: DJBMASTER] #370524
05/13/11 18:31
05/13/11 18:31
Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Ericmor Offline OP
Member
Ericmor  Offline OP
Member

Joined: Apr 2007
Posts: 125
Brazil - São Paulo
This topic shouldn´t have been moved.
The WRONG EXAMPLE IS IN THE MANUAL.
Did you read me post without paying attention?
I´ve tried a CODE SAMPLE FROM THE MANUAL, and this code sample IS WRONG, IS OUTDATED, IS NON-WORKING.
I thank you for the help with the correct syntax, but please, FIX THE MANUAL.

Re: Negation Comparision expression not working in Lite-C?!?!? [Re: Ericmor] #370525
05/13/11 19:06
05/13/11 19:06
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
The manual is correct. You took it out of context.

Note the first example:
Code:
10 < x

But if you tried:
Code:
if 10 < x

...you'd get an error because you always need parentheses around the comparison in an "if".

The manual says "if (comparison)" -- the comparison is always inside parentheses. Further sets of parentheses can be used to control precedence, but a comparison must reside in a pair of parentheses.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!

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