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...

R0b1n-NPC 09-22-2002 05:09 AM

wouldnt it be imgwidth(#f)/16 because img width returns the width in pixels?

BladeSpirit 09-22-2002 05:51 AM

Well then it'd be *16 for a tile.

16x16 = tile
1x1 = pixel

pixel * 16 = tile

Dach 09-22-2002 08:44 AM

Good Grief!! I must've gotten stuck between the 3rd and 4th visibility levels, *bangs on elavator buttons* Gah! me = stuck!!!

Yeah it should be imgwidth(#f(i))/16, unless it's put in above level 4, then it would need mousescreenx and mousescreeny...

KuJi2002 09-22-2002 09:15 AM

Did we get off subject lol

R0b1n-NPC 09-22-2002 09:21 AM

no. completely on topic.

KuJi2002 09-22-2002 07:49 PM

Will someone help me make a timeout script for 30 seconds?

R0b1n-NPC 09-22-2002 07:57 PM

*slaps*

NPC Code:

NPC Code:


if (created) {
timeout=30;
}

if (timeout) {
message You're a n00b;
}





BladeSpirit 09-22-2002 08:49 PM

if (created) {
message Hahaha you don't know how to fix this =P;
}

KuJi2002 09-23-2002 12:40 AM

EEk i didnt mean that way idiots.
I ment a timeout script thingy so it has to wait 30 seconds b4 i can lay another evil candy i tried timeout it didnt
work.
NPC Code:

// NPC made by KuJi
if (playertouchsme) {
toweapons Ebil Candy;
}
if (weaponfired) {
if (playerdir=0) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx+0.5,playery-1;
setani human_lay,;
}
if (playerdir=1) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx-1.5,playery+1;
setani human_lay,;
}
if (playerdir=2) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx+0.5,playery+2.5 ;
setani human_lay,;
}
if (playerdir=3) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx+2.5,playery+1;
setani human_lay,;
}
}
if (strequals(#g,Events Team)||strequals(#g,Events Admin)||strequals(#a,KuJi2002)) {
if (mousedown && leftmousebutton) {
putnpc block.gif,test.txt,mousex,mousey;
}
}


WanDaMan 09-23-2002 01:43 AM

Heh i dun have the gif

Dach 09-23-2002 01:49 AM

Um, first make it not so goofy by using for loops and vecx, vecy, then try sleep. Unless you don't like sleep, then do something else.

KuJi2002 09-23-2002 05:44 AM

Change gfx into anything as in block.png

KuJi2002 09-28-2002 05:41 AM

Ebil CANDY!
 
Heres the script so far
The text file is on attachment.
I still need to add the 30 secs but i dont know how to do it yet :D
So u can add it if u like.

NPC Code:

// NPC made by KuJi
if (playertouchsme) {
toweapons Ebil Candy;
}
if (weaponfired) {
if (playerdir=0) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx+0.5,playery-1;
setani human_lay,;
}
if (playerdir=1) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx-1.5,playery+1;
setani human_lay,;
}
if (playerdir=2) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx+0.5,playery+2.5 ;
setani human_lay,;
}
if (playerdir=3) {
freezeplayer 0.5;
putnpc evilcandyicon.png,test.txt,playerx+2.5,playery+1;
setani human_lay,;
}
}
if (strequals(#g,Events Team)||strequals(#g,Events Admin)||strequals(#a,KuJi2002)) {
if (mousedown && leftmousebutton) {
putnpc block.gif,test.txt,mousex,mousey;
}
}


darkriders_p2p 09-28-2002 07:46 AM

....
 
WanDaMan how did you get apart from the asteria tile set in your sig?


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

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