Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-29-2007, 12:56 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Post Math Help

I am finishing up an inventory script, but I need help for one part which is dropping an item. I want to make it so when the mousescreenx and mousescreeny variable is near the player another function begins. I'm not sure but I remember on an old script with it having something to do with %4 or something im not sure.

Help is appreciated, Thanks.
Reply With Quote
  #2  
Old 01-29-2007, 01:06 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Why not use mousex and mousey instead of mousescreenx?

Then you can compare mousex to player.x directly.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #3  
Old 01-29-2007, 01:11 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Because it is an inventory z.z. The items are not on the gmap they are on the screen
Reply With Quote
  #4  
Old 01-29-2007, 01:16 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Rapidwolve View Post
Because it is an inventory z.z. The items are not on the gmap they are on the screen
But if your mouse is dragging it, the mouse has a position on the screen AND on the board.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #5  
Old 01-29-2007, 01:18 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
The mouse is just making a duplicate image on the screen. It's still using the mousescreenx/y var. Also I need to make it so if the mouse is in front of the player the player.dir changes to down, or if its right, the player.dir changes to right. I think thats where I got the %4 from
Reply With Quote
  #6  
Old 01-29-2007, 01:26 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Rapidwolve View Post
Also I need to make it so if the mouse is in front of the player the player.dir changes to down, or if its right, the player.dir changes to right. I think thats where I got the %4 from
PHP Code:
player.dir getdir(mousex-player.x,mousey-player.y); 
Oh no, mousex variable! Unthinkable.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #7  
Old 01-29-2007, 01:27 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
I forgot that function existed, lol thanks. Now that thats done I realized another problem z.z.

Well im using a custom ItemLib with item IDs. {1-10 for currency, 200's guns, etc..}

PHP Code:
for (this.igetstringkeys("clientr.item_")){ 
Is what I am using, the problem is that. The script puts the item by the id number. For example I have "Dollar" as item_1. The script puts that in the first slot, I have no item_2 but I have item_3 as "Cent", so the script skips the next slot and puts it in the third one. I cant even see my gun which has an id of 240. Is it the way I'm using for();?
Reply With Quote
  #8  
Old 01-29-2007, 01:37 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Rapidwolve View Post
Is it the way I'm using for();?
Perhaps, I'm pretty sure the token before ":" is made to be a local variable, so I don't know what naming it this.- would do.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #9  
Old 01-29-2007, 01:39 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Even without the this.- its the same problem.
Reply With Quote
  #10  
Old 01-29-2007, 03:56 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
PHP Code:
for( temp.igetstringkeys"clientr.item_"))
  echo( 
makevar"clientr.item_" temp.i)); 
do this output anything?
__________________
Reply With Quote
  #11  
Old 01-29-2007, 09:03 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
HTML Code:
//#CLIENTSIDE
function onCreated()
{
  this.onTimeout();
}
function onTimeout()
{
  if (mousex in |player.x - 5, player.x + 5| && mousey in |player.y - 5, player.y + 5|)
  {
    //Do Direction...and drop effect
  }
  showimg(200, this.curImage, mousescreenx, mousescreeny);
  changeimgvis(200, 3);
}

Last edited by Chandler; 01-29-2007 at 10:13 PM..
Reply With Quote
  #12  
Old 01-29-2007, 10:08 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Chandler View Post
HTML Code:
  if (mousescreenx in |player.x - 5, player.x + 5| && mousescreeny in |player.y - 5, player.y + 5|)
  {
    //Do Direction...and drop effect
  }
mousescreen- and player.- position are using a different kind of coordinates.

It should be mousex-player.x in |-5,5| blah blah blah

Even better is
PHP Code:
if (((mousex-player.x)^2+(mousey-player.y)^2)^.5 5) {
  
// do stuffs

__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #13  
Old 01-29-2007, 10:13 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Tolnaftate2004 View Post
mousescreen- and player.- position are using a different kind of coordinates.

It should be mousex-player.x in |-5,5| blah blah blah
Or
HTML Code:
mousex in |player.x - 5, player.x + 5|
I should edit my post for mousex, not mousescreenx.
Reply With Quote
  #14  
Old 01-29-2007, 10:16 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Chandler View Post
Or
HTML Code:
mousex in |player.x - 5, player.x + 5|
I should edit my post for mousex, not mousescreenx.
Yeah, I didn't mean it needed to be exactly as I wrote it. That's merely my preference.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #15  
Old 01-29-2007, 10:18 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Tolnaftate2004 View Post
Yeah, I didn't mean it needed to be exactly as I wrote it. That's merely my preference.
Yeah, I prefer your way personally, as it looks more structured.
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 02:45 PM.


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