View Single Post
  #17  
Old 09-03-2012, 03:57 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
I send those parameters and then it breaks.. im thinking i need to reupdate the cord im triggering at maybe?

also, thanks for letting me know that about getimg...()... does that only apply to clientside or serverside as well?


EDIT: (Fixed, and working, now to clean it up)

PHP Code:
function onActionServerside(command, nx, ny) {
  if ( 
command == "move" ) {
    
x = nx;
    
y = ny;
    
this.oox = this.x;
    
this.ooy = this.y;
    
chat = "moved" SPC nx SPC ny;
  }
}


//#CLIENTSIDE
function onCreated() {
  
this.catchEvent(GraalControl, "onMouseDragged", "onMouseDragged");
  
setshape(1, getimgwidth(this.image), getimgheight(this.image));
  
this.oox = this.x;
  
this.ooy = this.y;
}

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;
  }
}

function 
onMouseUp() {
  if ( 
this.candrag == true ) {
    
this.candrag = fasle;
    
triggeraction(this.oox + .5, this.ooy +.5, "Serverside", "move", mousex, mousey);
    
this.oox = mousex;
    
this.ooy = mousey;
  }
}

function 
onMouseDragged(obj, mod, mx, my) {
  if ( 
this.candrag == true ) {
    
x = mousex - this.ox;
    
y = mousey - this.oy;
    
this.nnx = mousex - this.ox;
    
this.nny = mousey - this.oy;
  }
} 
I had to set new cord's when i moved it, and then it worked fine.
Reply With Quote