Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: td on Sat 29/07/2006 20:53:09

Title: Cursor changing
Post by: td on Sat 29/07/2006 20:53:09
Please tell me how should i do cursor changing function? In defaul project this function is already exists but i has been started empty project. How i undarstand this code locate in :

#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else {   // right-click, so cycle cursor
    mouse.SelectNextMode();
  }
}
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE



But "button" is > undefined token <

Whats wrong?
Title: Re: Cursor changing
Post by: limeTree on Sun 30/07/2006 12:29:33
What exactly do you want to do with cursor?(Change?)
Title: Re: Cursor changing
Post by: Khris on Sun 30/07/2006 12:56:40
Why don't you post the code you've used...
Title: Re: Cursor changing
Post by: td on Sun 30/07/2006 14:23:32
Quote from: lipaoklipa on Sun 30/07/2006 12:29:33
What exactly do you want to do with cursor?(Change?)

I wanna change cursor after right-click (as in default project).


Quote from: KhrisMUC on Sun 30/07/2006 12:56:40
Why don't you post the code you've used...

Eh? I already post it ...
Title: Re: Cursor changing
Post by: Khris on Sun 30/07/2006 15:21:28
Ok, you've posted the default on_mouse_click function, which of course should work perfectly fine.

There should be a line number stated in the error message.
Is it this line:Ã,  else if (button == eMouseLeft) {?
Title: Re: Cursor changing
Post by: td on Sun 30/07/2006 15:34:13
Quote from: KhrisMUC on Sun 30/07/2006 15:21:28
Ok, you've posted the default on_mouse_click function, which of course should work perfectly fine.

There should be a line number stated in the error message.
Is it this line:Ã,  else if (button == eMouseLeft) {?


Yes. >>> Error : undefined simbol "button"
I just paste this  "on_mouse_click " function from defaul project to New project and expected this should be work... Where i has mistaken???
Help Khris!
Title: Re: Cursor changing
Post by: Khris on Sun 30/07/2006 16:16:14
I'm not sure what you did, and I have no idea why you're getting that error, sorry.

But why did you paste this code into the global script?
Even the empty game template already contains a working on_mouse_click function that looks exactly like the one you posted.
Title: Re: Cursor changing
Post by: limeTree on Sun 30/07/2006 16:51:44
yeah,right click should always work,all you have to do is import sprite for cursors,i think,i always start with default