Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 03-05-2007, 04:58 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by Angel_Light
I'm just curious, is there a way to make it add and minus speed using the mouse wheel?
Try this:

PHP Code:
function onMouseWheel()
{
     if (!(
this.speed+>= 10) && !(this.speed-<= 1))
     {
          
this.speed +=- mousewheeldelta;
     }

__________________
What signature? I see no signature?
Reply With Quote
  #17  
Old 03-05-2007, 05:59 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by godofwarares View Post
Try this:

PHP Code:
function onMouseWheel()
{
     if (!(
this.speed+>= 10) && !(this.speed-<= 1))
     {
          
this.speed +=- mousewheeldelta;
     }

+=-?
__________________
Skyld
Reply With Quote
  #18  
Old 03-05-2007, 06:52 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Riot View Post
or even this.status = !this.status;
That is my preference too, however, I felt like having fun with math, as you can see from the overall code
__________________
Reply With Quote
  #19  
Old 03-05-2007, 07:11 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by Skyld
+=-?
Adds if the integer is positive, subtracts if negative . . . Some stupid unneeded operator ._.
__________________
What signature? I see no signature?
Reply With Quote
  #20  
Old 03-05-2007, 07:17 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by godofwarares View Post
Adds if the integer is positive, subtracts if negative . . . Some stupid unneeded operator ._.
It's not an operator; it's doing what it says:
PHP Code:
temp.foo += -temp.bar
i.e.
PHP Code:
temp.foo 0;
temp.foo +=- 3
... equals -3.
PHP Code:
temp.foo 0;
temp.foo +=- -3
... equals 3.
PHP Code:
temp.foo 0;
temp.foo -=+ 3
... equals -3.
PHP Code:
temp.foo 0;
temp.foo -=+ -3
... equals 3.
__________________
Skyld
Reply With Quote
  #21  
Old 03-05-2007, 07:39 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by godofwarares View Post
Adds if the integer is positive, subtracts if negative . . . Some stupid unneeded operator ._.
Gramatically speaking, what you just said would be adding the absolute value, because subtracting a number when it is negative is like adding its positive, and actually, that is NOT what it is doing, its simply adding the negative of a variable.

In this case, this.speed +=- mousewheeldelta is better written as
this.speed -= mousewheeldelta
__________________
Reply With Quote
  #22  
Old 03-06-2007, 01:43 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Ugh i'm getting my operators screwed up -_-
__________________
What signature? I see no signature?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:04 PM.


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