Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   : and ? (https://forums.graalonline.com/forums/showthread.php?t=3578)

Bravo_NPC-Admin1 05-26-2001 12:21 PM

: and ?
 
Can someone tell me what the commands : and ? do? I have seen them in codes and they aren't documented (pretty sure).
Here is an example from a code I have:

this.speed = (this.size==1? 1 : this.size==2? 1.2: 1.5);

Thanks a bunch

WhoopA 05-26-2001 01:25 PM

?: is a C construct similar to the if statement. Graal doesn't support it as far as I know. Syntax is thus:

(condition) ? (true-statement) : (false-statement)

The ?: construct is more compact than the if statements. That code snippet you have there? I'll expand it into if's.

if (this.size == 1) {
this.speed = 1;
} else if (this.size == 2) {
this.speed = 1.2;
} else {
this.speed = 1.5;
}


Bravo_NPC-Admin1 05-27-2001 03:48 AM

Thanks! ^_^

Er1c 05-27-2001 04:24 AM

? and : are supported by graal.

WhoopA 05-27-2001 08:39 AM

Well, I'll be [danned].


All times are GMT +2. The time now is 04:37 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.