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 08-25-2002, 08:33 PM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
mouseX and mouseY help

If i had a 16x16Pixle image (1 Graal tile square) NPC that size too loacated at X=32 and Y=32 how would I make it so that if it was ANYWHERE on the NPC it would:

message test;

I want it to cover the whole NPC which I dont know how to do anyone know how to make it see if the mouse is ANYWHERE on the NPC thats 16x16pixles?

Thanks in advanced to those who may help, If i dont get a chance to thank you later.

Last edited by Spark910; 08-25-2002 at 10:39 PM..
Reply With Quote
  #2  
Old 08-25-2002, 09:21 PM
Dragona2002 Dragona2002 is offline
Registered User
Join Date: May 2002
Location: The Netherlands
Posts: 105
Dragona2002 is on a distinguished road
Send a message via AIM to Dragona2002 Send a message via Yahoo to Dragona2002
if (mousex==32&&mousey==32) {
message test;
}else {
message ;
}
__________________

Quote:
The Dark Nemesis begins.......
Reply With Quote
  #3  
Old 08-25-2002, 10:37 PM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
That didnt work!? =(
Reply With Quote
  #4  
Old 08-25-2002, 10:45 PM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
hah! Look i did it by my self (Thats good for me!)

NPC Code:

// NPC made by Spark911
if (playerenters) {
timeout=.05;
}
if (timeout) {
if (mousex=>32&&mousex=<33&&mousey=>32&&mousey=<33) {
message test;
timeout=.05;
}

else {
message ;
}
timeout=.05;
}

Reply With Quote
  #5  
Old 08-25-2002, 11:14 PM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
Since people want to speak ill'y of peoples coding styles, THIS was horrible x.X
NPC Code:

if (created){
timeout=0.25;
}

if (timeout)
{ for (i=0;i<playerscount;i++)
{ if (abs(mousex-x)=<1 && abs(mousey-y)=<1)
{message test;}
else message ;
}
timeout=0.25;
}


Original code by Shifter XP. And unlike yours, which will ONLY do it if it is at that certain X and Y, mine will do it regardless of where really. 0.05 timeout... he he, I really don't use it anymore. 0.1 laggs a bit w/ an NPC Server, but 0.25 still does it enough times a second where it makes no differece
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #6  
Old 08-25-2002, 11:37 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
.. you could have used testnpc too
something like:
NPC Code:

if (created||timeout){
if (testnpc(mousex,mousey)<=0){
with (npcs[testnpc(mousex,mousey)]){
message test;
}
}
timeout=.05;
}


or you could use == instead if you want it to relate to the npc with that index
__________________

Reply With Quote
  #7  
Old 08-25-2002, 11:45 PM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
Quote:
Originally posted by emortylone
Since people want to speak ill'y of peoples coding styles, THIS was horrible x.X
NPC Code:

if (created){
timeout=0.25;
}

if (timeout)
{ for (i=0;i<playerscount;i++)
{ if (abs(mousex-x)=<1 && abs(mousey-y)=<1)
{message test;}
else message ;
}
timeout=0.25;
}


Original code by Shifter XP. And unlike yours, which will ONLY do it if it is at that certain X and Y, mine will do it regardless of where really. 0.05 timeout... he he, I really don't use it anymore. 0.1 laggs a bit w/ an NPC Server, but 0.25 still does it enough times a second where it makes no differece
---Shifter


Im only learning, I dont understand ''For'' nor do I undestand ''i=0'' nor do I understand ''abs''! =(
Reply With Quote
  #8  
Old 08-26-2002, 03:04 AM
Dragona2002 Dragona2002 is offline
Registered User
Join Date: May 2002
Location: The Netherlands
Posts: 105
Dragona2002 is on a distinguished road
Send a message via AIM to Dragona2002 Send a message via Yahoo to Dragona2002
mathematical i cant do that 2 X.x
i hate that
i also cant use test things and that sux
can some1 explain us our just meh ?
__________________

Quote:
The Dark Nemesis begins.......
Reply With Quote
  #9  
Old 08-26-2002, 08:25 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
omg! Here is a QUICK explanation of the for command
for consists of THREE parts:
i=0; is generally the first. i is a variable, it can be about any letter. 0 is set to the starting point. you could do i=100 and 100 would be the starting point.
2nd Part) i<allplayerscount; is a generally used one. it says that it will continue if i<allplayerscount
3rd Part) i ++ it means that if the 2nd part is still true, it makes i go up one. I is basically a variable. so here is an example:
NPC Code:

for (i=1;i<playerscount;i++)
{ players[i].x=30;
players[i].y=30;
}


it starts at i=1 (0 is the current player, so it does it for EVERYONE but the current player)
then it will add 1 to i until i equals the playerscount (playerscount = players in THAT level, allplayers is the entire server)
so then it would set every player except the one who started the reaction, to 30 30.
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #10  
Old 08-26-2002, 09:27 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
LOL, Kai, true, for is not a COMMAND. It is a technicality =P But regardless, I know how to use it XD
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #11  
Old 08-27-2002, 08:48 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
RAWR, don't make it so complex X.x

NPC Code:

if (created || timeout) {
message ;
if (mousex in |32,3.9999| && mousey in |32,32.9999|) {
message test;
}
timeout = .05;
}

__________________
[signature]insert here[/signature]
Reply With Quote
  #12  
Old 08-27-2002, 10:59 PM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
x.X You don't get it at ALL do you screen_name? That is a HORIBLE way to do it x.X You are again, SPECIFYING the location of it, the way I did it was:
1) In NO way complex, simple for command x.X if you think that is complex, you'd have a heartache seeing some of my scripts =P
2) If you have your mouse in location to the NPC, rather than in location of the level, which works MUCH better, and you can move the NPC around w/o recoding.
Kai: Yes, I know how to use it Technicalities matter little, if you can use it properly and not get errors is what counts
I have a feeling Kai would agree more w/ my explanation of how to do this
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #13  
Old 08-28-2002, 02:10 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by emortylone
x.X You don't get it at ALL do you screen_name? That is a HORIBLE way to do it x.X You are again, SPECIFYING the location of it, the way I did it was:
1) In NO way complex, simple for command x.X if you think that is complex, you'd have a heartache seeing some of my scripts =P
2) If you have your mouse in location to the NPC, rather than in location of the level, which works MUCH better, and you can move the NPC around w/o recoding.
Kai: Yes, I know how to use it Technicalities matter little, if you can use it properly and not get errors is what counts
I have a feeling Kai would agree more w/ my explanation of how to do this
---Shifter
I do believe spark said that it was at 32,32

in either case, just change the first 32's in my script to x and the second set of 32's to y
__________________
[signature]insert here[/signature]
Reply With Quote
  #14  
Old 08-28-2002, 02:32 AM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
I understand screen_names more then ''abs'' but sort of understand ''abs'' so thanks to all of you. And no need to argue about it please, I only needed help not World war 3
Reply With Quote
  #15  
Old 08-29-2002, 11:00 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
abs() = absolute value of whats in the ()
they never really answered you so i did
I learnt that from mah calculator coding o.O
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

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 10:13 PM.


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