Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Mouse Script! (https://forums.graalonline.com/forums/showthread.php?t=38252)

KuJi2002 09-20-2002 06:06 PM

Mouse Script!
 
1 Attachment(s)
// NPC made by KuJi
if (playertouchsme) {toweapons Test;
}
if (actionleftmouse) {
putnpc block.gif,test.txt,mousex,mousey;
}

Y do i have to click the npc and where my x/y where i clicked the npc it lays.

Com013 09-20-2002 06:24 PM

actionleftmouse is sent whenever the player clicks on the NPC.

You'd have to use the event "mousedown". It is triggered when any button was pressed, no matter where you pressed it.

Your script would have to look like that:

NPC Code:

if (playertouchsme) {
toweapons Test;
}
if (mousedown && leftmousebutton) {
putnpc block.gif,test.txt,mousex,mousey;
}



That should work.

KuJi2002 09-21-2002 02:05 AM

Thanks
It worked now i just gotta finish working the deleting of them lol
Im gonna see if it will work with what u thought me :D

KuJi2002 09-21-2002 02:08 AM

Thanks a bunch!
 
Finished yay!

Torankusu 09-21-2002 02:12 AM

I was fooling around the other day with the mousedown and mousex/y commands.

I'll post what I had here shortly.

WanDaMan 09-21-2002 04:06 AM

Yeh i want to make a script were when u put ur cursur under a npc or player i says somet=)

Knuckles 09-21-2002 04:35 AM

NPC Code:

if (playerenters || timeout) {
if (mousex in |playerx,playerx+3| && mousey in |playery,playery+3|) {message sommet;}
else {message ;}
timeout=0.05;
}


Dach 09-21-2002 04:54 AM

NPC Code:

if (mousex in |npcs[i].x,npcs[i].x+imgwidth(#f(i))| && mousey in |npcs[i].y,npcs[i].y+imgheight(#f(i))|) {
message Don't point, it's rude!;
}else{message ;}



Bah, I know this isn't the whole script, but now you get the fun of finishing it! Whoop-diedoo...

[EDIT] *bangs head on wall* forgot img for w/h...

emortylone 09-21-2002 05:14 AM

LOLz. I usually do a timeout and check if abs(mousex-x)=<2 && abs(mousey-y)=<2 something like that so that it checks for the distance :)
---Shifter

Dach 09-21-2002 05:43 AM

when you do that this is what happens:
Black - target area of what you want to be clickable
white - areas that are also clickable
http://members.aol.com:/michaelangelo36/tiles.gif

Unless for whatever reason your images are centered on their x/y...

WanDaMan 09-21-2002 05:07 PM

Thanks knuckles youve helped me alot!

R0b1n-NPC 09-21-2002 05:23 PM

Quote:

Originally posted by Dach
NPC Code:

if (mousex in |npcs[i].x,npcs[i].x+width(#f(i))| && mousey in |npcs[i].y,npcs[i].y+height(#f(i))|) {
message Don't point, it's rude!;
}else{message ;}



Bah, I know this isn't the whole script, but now you get the fun of finishing it! Whoop-diedoo...

isnt it imgwidth not width && imgheight not height?

KuJi2002 09-21-2002 09:26 PM

Quote:

Originally posted by R0b1n-NPC


isnt it imgwidth not width && imgheight not height?

??

R0b1n-NPC 09-21-2002 09:35 PM

was talking to chad

Dach 09-22-2002 12:39 AM

Crap, yeah that's what I meant to put...


All times are GMT +2. The time now is 01:51 AM.

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