Cursor changing

Started by td, Sat 29/07/2006 20:53:09

Previous topic - Next topic

td

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?

limeTree

What exactly do you want to do with cursor?(Change?)

Khris

Why don't you post the code you've used...

td

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

Khris

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:
Code: ags
Ã,  else if (button == eMouseLeft) {
?

td

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:
Code: ags
Ã,  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!

Khris

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.

limeTree

yeah,right click should always work,all you have to do is import sprite for cursors,i think,i always start with default

SMF spam blocked by CleanTalk