Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Oncer on Fri 06/05/2005 14:31:58

Title: [BUG] Unexpected Cursor Mode Change
Post by: Oncer on Fri 06/05/2005 14:31:58
Maybe it's a bug, maybe it's just me, but I experience the following (very annoying problem):
It seems that the cursor mode changes from 0 to 1 when I go to an other room.
Dunno why this happens. I'll try to track down when it occours exactly.

EDIT: Ok, I've found it. I have one "normal" room and one room with "Hide Player Character" enabled. If I go to the second room and then return to the "normal" (first) room, the cursor mode is 1, although it was 0 when I was in that room the first time.
This is a problem for me, because I don't want to say "SetCursorMode(0);" in every room! ::)

I'm using AGS Version 2.62, but I haven't seen anything like this in the changelog for 2.70.
Title: Re: [BUG] Unexpected Cursor Mode Change
Post by: Ashen on Fri 06/05/2005 14:54:10
I'd guess it's because cursor mode 0 (Walk) is disabled in the second room (player hidden), so the cursor is automaticly changed to the next mode on entry. Then, the current mode is kept when you move back. It's the same as if you change the mode to 3 (use), then change rooms - the cursor stays as mode 3. So, it's probably not on the change log, as it's not really something to be fixed.

Do you really want to auto-change the mode to Walk whenever you enter a room? If so, you might be best using the ENTER_ROOM parameter of on_event, e.g.:

function on_event (int event, int data) {
  if (event == ENTER_ROOM) {
    SetCursorMode (MODE_WALK);
    // if you enter a room where WALK is disabled, it'll set it to LOOK, as it currently does
  }
}


But, personally I'd find this annoying in a game. If there's only a few specific cases though, it might be easier to set them up on a room-by-room basis.
Title: Re: [BUG] Unexpected Cursor Mode Change
Post by: Oncer on Fri 06/05/2005 15:43:09
Why should this be annoying in a game? The cursor mode is "walk" anyways if I walk to a new room!

Thanks for your help!  :D

EDIT: When I enter the room and the Cursor Mode is switched, the "Look" text shows up in the status bar (LucasArts style) for a short time. How can I prevent this?
Title: Re: [BUG] Unexpected Cursor Mode Change
Post by: Ashen on Fri 06/05/2005 15:56:08
QuoteThe cursor mode is "walk" anyways if I walk to a new room
True, I suppose I was thinking of cases like 'USE door', instead of WALK, as in the situation you have - I'd imagine you'd need to USE something to get out of the second room, since you can't walk.
I just don't like the idea of the game choosing the cursor mode for me - but I suppose that's what it does when you go to a room with the player hidden, and anyway, I'm not sure I'd even notice in-game.

And, I'm not sure what script you're using exactly, but maybe copying the SetLabelText () part of it in to the on_event might help, e.g.:


function on_event (int event, int data) {
  if (event == ENTER_ROOM) {
    SetCursorMode (MODE_WALK);
    // if you enter a room where WALK is disabled, it'll set it to LOOK, as it currently does
    SetLabelText (GUI, LABEL, "Walk to");
    // where GUI and LABEL are the GUI and Object numbers of the stus display)
  }
}

(Obviously, the exact code will be different, depending on how your LEC GUI is set up.)
Title: Re: [BUG] Unexpected Cursor Mode Change
Post by: Oncer on Fri 06/05/2005 16:05:36
Thanks again! Phew, that was fast. Now I know the benfit of using a very popular engine ^^

The SetLabelText did it. I had to add a space after "Walk to", so it is now "SetLabelText(0,8,"Walk to ");
This is because the normal text is "Walk to @OVERHOTSPOT@" and the text is centered in the statusline. If I don't add the space, the text isn't exactly in the correct position.

Oncer