Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-03-2012, 02:56 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Triggeraction Difficulties

I have been playing around with a script, but I am having problems. I try to drag the NPC using this script but it only triggers if I mouseup on the same spot it origonally was.. which is odd.. and when it triggers.. it triggers every NPC that is joined to the class.. anyone got any ideas whats wrong o.O

PHP Code:
function onActionServerside(command, nx, ny) {
  
chat = command;
}

//#CLIENTSIDE
function onCreated() {
  
this.catchEvent(GraalControl, "onMouseDragged", "onMouseDragged");
  
setshape2(1, getimgwidth(this.image), getimgheight(this.image));
}

function 
onMouseDown() {
  if ( 
mousex in |x,x+getimgwidth(this.image)/16| && mousey in |y,y+getimgheight(this.image)/16| ) {
    
this.ox = mousex - x;
    
this.oy = mousey - y;
    
this.candrag = true;
    
// clicked on it
  
}
}

function 
onMouseUp() {
  
this.candrag = false;
  
triggeraction(mousex, mousey, "Serverside", "test");
}

function 
onMouseDragged(obj, mod, mx, my) {
  if ( 
this.candrag = true ) {
    
//triggeraction(x, y, "Serverside", "test");
    
x = mousex - this.ox;
    
y = mousey - this.oy;
  }
} 
I have tried triggering at the following cords:
PHP Code:
this.ox, this.oy
mousex
, mousey
x
, y 
With no luck, both before and after updating the x/y values.
Reply With Quote
 


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 09:02 PM.


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