Cursor won't change!

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

Previous topic - Next topic

monkey0506

Yeah, I kind of knew that, but I guess I just forgot. Edwin, if you want several things to run only if a specific statement is true for each, use else if statements:

if (button==1) //stuff for button 1
else if (button==2) //stuff for 2

But, if you want several things to be able to happen at once, such as if you are pressing up and right, move the cursor up AND right:

if (IsKeyPressed(372)==1) SetMousePosition(mouse.x, mouse.y-2);
if (IsKeyPressed(377)==1) SetMousePosition(mouse.x+2, mouse.y);

The first would run the whole script as a single statement, so that if the button was 1, it couldn't possibly be 2. The second script would run each if statement as a separate statement, so if you pressed up it would move the cursor up, right would move it right, and both would move it up-right. Does this help you understand where else statements are necessary? I certainly hope so... Also, please try not to confuse AGS scripting with BB scripting... The script for code should be (where bold parenthesis () are replaced with brackets []:
(code) if (blah==bleh) bah;(/code)

Not to sound rude, but your last post was confusing. Great. Scorpiouriuosyousyuouisos beat me to posting. Anyway, the Preview button is always nifty...

Edwin Xie

#41
By the way, by clicking the Select button, it uses that cursor and cannot change to anything else. You can't even select an item!

EDIT: In the help file it states:
Quote
SetMouseCursor
SetMouseCursor(int new_cursor)

Changes the appearance of the mouse cursor to NEW_CURSOR. Unlike the SetCursorMode function (see above), this does not change the mode used if the user clicks on a hotspot. This is useful for displaying a "wait" cursor temporarily.
Example:

SetMouseCursor(8);

will change the mouse cursor to the cursor number 8 specified in the cursor's tab.
So, the the main problem is this. If I did an alternative it would be too long with the "DisableMouseCursor" so, I am asking for an alternative way to do
Code: ags
DisableCursorMode(INT_CURSOR);
DisableCursorMode(INT_CURSOR);
DisableCursorMode(INT_CURSOR);
DisableCursorMode(INT_CURSOR);
DisableCursorMode(INT_CURSOR);
DisableCursor...................................
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Edwin Xie

#42
Bump!
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

monkey0506

It's not necessary to disable a cursor just because it's not in use. Nor is it logical, unless you have some MAJOR reason to do so. Just leave them all enabled, and see how it works.  :)

Edwin Xie

#44
Look, what I really want to do is give my inventory GUI the normal traits of the regular Inventory GUI but there is something messing that up. And later I will PM the adress to you so you can see the main problem, ok?


EDIT: Nevermind. It's working perfectly right now. (Since I fixed the code)
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

monkey0506

Wait... Mr. I Have Problems With Cursors just said "It's working perfectly"?  :o :o :o Edwin, tell us all how you reached this miraculous moment in time where YOU actually got it to work (a.k.a. Show us your script)

Edwin Xie

Now this is just a mystery, if I replace the bad script with the original script BEFORE it didn't work. Right now it works. Is there some kind of bug in AGS like that? I am using the current version (not the rc1).
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

monkey0506

What? Well maybe there's some differences. Show us the scripts so we can see what you're talking about. Also, are you saying that it works? You're kind of confusing me...

Edwin Xie

Ok, once when I had to implement the status bar, I used this script:

if (GetCursorMode()==0) SetLabelText(0,0,"Walk to @OVERHOTSPOT@");
if (GetCursorMode()==1) SetLabelText(0,0,"Look at @OVERHOTSPOT@");
if (GetCursorMode()==2) SetLabelText(0,0,"Interact with @OVERHOTSPOT@");
if (GetCursorMode()==3) SetLabelText(0,0,"Talk to @OVERHOTSPOT@");
if (GetCursorMode()==4) {
string usinginv;
string useinvtxt;
StrCopy (useinvtxt, "Use ");
GetInvName(character[GetPlayerCharacter()].activeinv,usinginv);
StrCat (useinvtxt,usinginv);
StrCat (useinvtxt," with ");
StrCat (useinvtxt,"@OVERHOTSPOT@");
SetLabelText(0,0,useinvtxt);
}
}

The game said it didn't work when I used this.

Here is the script that worked:

if (GetCursorMode()==0) SetLabelText(0,0,"Walk to @OVERHOTSPOT@");
if (GetCursorMode()==1) SetLabelText(0,0,"Look at @OVERHOTSPOT@");
if (GetCursorMode()==2) SetLabelText(0,0,"Interact with @OVERHOTSPOT@");
if (GetCursorMode()==3) SetLabelText(0,0,"Talk to @OVERHOTSPOT@");
if (GetCursorMode()==4) {
string usinginv;
string useinvtxt;
StrCopy (useinvtxt, "Use ");
GetInvName(character[GetPlayerCharacter()].activeinv,usinginv);
StrCat (useinvtxt,usinginv);
StrCat (useinvtxt," with ");
StrCat (useinvtxt,"@OVERHOTSPOT@");
SetLabelText(0,0,useinvtxt);
}
}

Anything different with the script? Probably not. Wierd.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

SMF spam blocked by CleanTalk