View Single Post
  #14  
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(commandnxny) {
  if ( 
command == "move" ) {
    
nx;
    
ny;
    
this.oox this.x;
    
this.ooy this.y;
    
chat "moved" SPC nx SPC ny;
  }
}


//#CLIENTSIDE
function onCreated() {
  
this.catchEvent(GraalControl"onMouseDragged""onMouseDragged");
  
setshape(1getimgwidth(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 .5this.ooy +.5"Serverside""move"mousexmousey);
    
this.oox mousex;
    
this.ooy mousey;
  }
}

function 
onMouseDragged(objmodmxmy) {
  if ( 
this.candrag == true ) {
    
mousex this.ox;
    
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