Cursor won't change!

Started by Edwin Xie, Fri 27/08/2004 06:56:00

Previous topic - Next topic

Edwin Xie

I try to use SetCursorMode(6); to set the cursor mode 6 but it stays at 0!
EDIT: I was probably so angry I forgot about elling you guys what I was tying to do!
What I was trying to do:
For some GUIs I want it to be the pointer cursor but for some strange reason it was the walk cursor. That is all I can say, unless you want the script or the GUIs I want to have the pointer icon on:

This script may be familiar to some of you:
Code: ags

CentreGUI(3);
Ã,  if (interface == 3){
Ã,  Ã,  if (button == 8) SetGameSpeed(GetSliderValue(3,8));
Ã,  Ã,  else if (button == 9) SetMusicMasterVolume(GetSliderValue(3,9));
Ã,  Ã,  else if (button == 10) game.text_speed = GetSliderValue(3,10);
Ã,  Ã,  else {
Ã,  Ã,  if (button == 0) SaveGameDialog();
Ã,  Ã,  if (button == 1) RestoreGameDialog();
Ã,  Ã,  if (button == 2) GUIOn(4);
Ã,  Ã,  if (button == 3){
Ã,  Ã,  Ã,  SetCursorMode(6);
Ã,  Ã,  Ã,  RestartGame();
Ã,  Ã,  Ã,  }
Ã,  Ã,  if (button == 4) 
Ã,  Ã,  Display("The Adventures of Bob I [[Made with Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2004 Chris Jones");
Ã,  Ã,  }
Ã,  if (button == 11){
Ã,  Ã,  InterfaceOff (3);
Ã,  Ã,  InterfaceOn (ICONBAR);
Ã,  Ã,  SetCursorMode (1);
Ã,  Ã,  }
Ã,  }

The other GUI:
Code: ags

if (interface == 4)
Ã,  SetCursorMode(6);
Ã,  SetMouseCursor(6);
Ã,  DisableCursorMode(0);
Ã,  DisableCursorMode(1);
Ã,  DisableCursorMode(2);
Ã,  DisableCursorMode(3);
Ã,  DisableCursorMode(5);
Ã,  {
Ã,  if (button == 0)
Ã,  QuitGame(0);
Ã,  else if (button == 1)
Ã,  GUIOff(4);
Ã,  EnableCursorMode(0);
Ã,  EnableCursorMode(1);
Ã,  EnableCursorMode(2);
Ã,  EnableCursorMode(3);
Ã,  EnableCursorMode(5);
Ã,  SetCursorMode(0);
Ã,  }
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay

#1
[post now irrelevant]

Edwin Xie

Hey, just to let you know, I modified my the first post of this topic!
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay

Your code is currently in "interface_click" - which means it is only run when the GUI is actually clicked on.
You want to put that code in the repeatedly_execute. And I modified it here so it will work:

Code: ags
if (GetGUIAt(mouse.x,mouse.y) == 4) SetMouseCursor(6);
 else SetDefaultCursor();

Put that in the repeatedly_execute.

And remove the following lines from the interface_click:
Code: ags

  SetCursorMode(6);
  SetMouseCursor(6);
  DisableCursorMode(0);
  DisableCursorMode(1);
  DisableCursorMode(2);
  DisableCursorMode(3);
  DisableCursorMode(5);

Those lines above are messing up your brackets.

I'm not an expert on this either, but I'm pretty sure it should work.

Edwin Xie

#4
I don't get it, how is it in interface_click?

Parse error: unexpected "if"
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay

The parse error: Check that the line above it ends in a semicolon.

As far as why it was in interface_click, AGS automatically puts it there when you go to edit your gui code.

Edwin Xie

It ends in a semicolon but it mentioned "if"
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay


Edwin Xie

Code: ags

if (GetGUIAt(mouse.x,mouse.y) == 4) SetMouseCursor(6);
else SetDefaultCursor();
else if (GetGUIAt(mouse.x,mouse.y) ==3) SetMouseCursor(6);
else SetDefaultCursor();
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay

Change that code to:
Code: ags

if (GetGUIAt(mouse.x,mouse.y) == 4) SetMouseCursor(6);
else if (GetGUIAt(mouse.x,mouse.y) ==3) SetMouseCursor(6);
else SetDefaultCursor();


If you still get the error, post the code before and after the "if" statement as well.

Edwin Xie

#10
I still get the error...
Quote from: JaysSite on Fri 27/08/2004 22:10:30
Change that code to:
Code: ags

if (GetGUIAt(mouse.x,mouse.y) == 4) SetMouseCursor(6);
else if (GetGUIAt(mouse.x,mouse.y) ==3) SetMouseCursor(6);
else SetDefaultCursor();


[partidontget]If you still get the error, post the code before and after the "if" statement as well.[/partidontget]


I don't get it...
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay

There is a text scripting tutorial in the AGS help file. It's dated, but maybe it'll give you a few tips. I've spotted a few easy mistakes that you made, and it'll probably frustrate you if you have to keep coming back to the forum.

Anyway, post your entire repeatedly_execute so I can see why you're getting the error.

Mr Jake

the reason he got that error was because he had and If statement, and if that wasn't satisfied it was doing 2 else statements and an else if. Which is stupid

Edwin Xie

#13
Code: ags

function repeatedly_execute() {
Ã,  // LEC Statusline
string bunky;string texty; int cursy;
StrCopy (texty, "");Ã,  cursy=GetCursorMode();Ã,  
if (cursy==0){Ã,  Ã,  StrCat(texty,"Walk to ");}Ã,  
else if (cursy==1) {Ã,  Ã,  StrCat (texty,"Look at ");}Ã,  
else if (cursy==2) {Ã,  Ã,  StrCat(texty,"Use ");}Ã,  
else if (cursy==3) {Ã,  Ã,  StrCat(texty,"Talk to ");}Ã,  
else if (cursy==4) {Ã,  Ã,  StrCat(texty,"Use ");Ã,  Ã,  
GetInvName (player.activeinv, bunky);Ã,  Ã,  
StrCat(texty,bunky);Ã,  Ã,  StrCat(texty," with ");}Ã,  
else if (cursy==5) {Ã,  Ã,  StrCat(texty, "Pick up ");}Ã,  
else if (cursy==8) {Ã,  Ã,  StrCat(texty, "Open ");}Ã,  
GetLocationName(mouse.x,mouse.y,bunky);Ã,  
StrCat(texty,bunky);Ã,  
SetLabelText (0,0,texty);
}
if (GetGUIAt(mouse.x,mouse.y) == 4) SetMouseCursor(6);
else if (GetGUIAt(mouse.x,mouse.y) ==3) SetMouseCursor(6);
else SetDefaultCursor();


EDIT: Ok, something is definately wrong cursor 6. In GUIs, Cursor 6 does not work at all!
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

You have to put the 'if (GetGUIAt(...))' part within the function's body:
Code: ags

function repeatedly_execute() {
	// LEC Statusline
	string bunky;
	string texty;
	int cursy;

	StrCopy (texty, "");
	cursy=GetCursorMode();

	if 	(cursy==0) StrCat(texty,"Walk to ");
	else if (cursy==1) StrCat (texty,"Look at ");
	else if (cursy==2) StrCat(texty,"Use ");
	else if (cursy==3) StrCat(texty,"Talk to ");
	else if (cursy==4) {
		StrCat(texty,"Use ");
		GetInvName (player.activeinv, bunky);
		StrCat(texty,bunky);
		StrCat(texty," with ");
	}
	else if (cursy==5) StrCat(texty, "Pick up ");
	else if (cursy==8) StrCat(texty, "Open ");

	GetLocationName(mouse.x,mouse.y,bunky);
	StrCat(texty,bunky);
	SetLabelText (0,0,texty);

	if (GetGUIAt(mouse.x,mouse.y) == 4) SetMouseCursor(6);
	else if (GetGUIAt(mouse.x,mouse.y) ==3) SetMouseCursor(6);
	else SetDefaultCursor();
}

Edwin Xie

Hmm, then it would only change to cursor 6 if your mouse moves over the GUI
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

In that case put the following code within the repeatedly_execute function:

if (IsGUIOn(3) || IsGUIOn(4)) SetMouseCursor(6);
else SetDefaultCursor();

Edwin Xie

Let's say I want the label to change to "  " (nothing) when GUI 3 and 4 are clicked. How do I do that?
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

Do you mean a click anywhere over a GUI, or only over GUI buttons?

Edwin Xie

Oh, wait, sorry i didn't give enough details. I wanted the status bar label to change to "   " (nothing) if GUI 3 or 4 were open.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

SMF spam blocked by CleanTalk