Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Err Help with this script (https://forums.graalonline.com/forums/showthread.php?t=64958)

napo_p2p 03-28-2006 06:38 AM

Quote:

Originally Posted by ZeLpH_MyStiK
Oh no! Projectshifter is getting old!
this.active = (this.active + 1) % 2;
4 lines? try 4 - 3.

But this.active = 1 - this.active; is, like, more sekc.

BUT this.active = !this.active; is the sekciest of them all! <3 GS2.

Projectshifter 03-28-2006 07:01 AM

Quote:

Originally Posted by ZeLpH_MyStiK
Oh no! Projectshifter is getting old!
this.active = (this.active + 1) % 2;
4 lines? try 4 - 3.

Wow, maybe I am getting old :O I'm going to stop getting on my computer for the first 10 minutes after I wake up. Somehow the use of % totally slipped my mind. Good call though. I'm going to spend this week brushing up on gscript again.

ZeLpH_MyStiK 03-28-2006 08:42 PM

Quote:

Originally Posted by napo_p2p
But this.active = 1 - this.active; is, like, more sekc.

BUT this.active = !this.active; is the sekciest of them all! <3 GS2.

But modulus allows you to have more than 2 switch modes.
i.e.
NPC Code:

this.switch = (this.active + 1) % 3; // <-- 3 switches!
this.switch = (this.active + 1) % 4; // <-- or 4!



Quote:

Originally Posted by Projectshifter
Wow, maybe I am getting old :O I'm going to stop getting on my computer for the first 10 minutes after I wake up. Somehow the use of % totally slipped my mind. Good call though. I'm going to spend this week brushing up on gscript again.

You better! :O It's about time we started on N-Pulse: Improved!

ApothiX 03-30-2006 04:05 PM

Quote:

Originally Posted by ZeLpH_MyStiK
But modulus allows you to have more than 2 switch modes.
i.e.
NPC Code:

this.switch = (this.active + 1) % 3; // <-- 3 switches!
this.switch = (this.active + 1) % 4; // <-- or 4!


But negating the value of a boolean only allows you to have two modes, so I don't know why you're preaching modulus!


All times are GMT +2. The time now is 08:19 AM.

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