Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Gepard on Sat 19/05/2007 23:12:26

Title: SOLVED custom cursor
Post by: Gepard on Sat 19/05/2007 23:12:26
Hello there!

I would like to have a special cursor. I decided to use Usermode cursor 1 for this. I did the graphic, but it doesnt appear in the game. Also, I want this cursor to work this way:

When a player is in a room and he clicks the mouse (while having this cursor active), a text message will pop-up (for each room another message). Is it possible to do this?

Thank you very much.
Title: Re: custom cursor
Post by: Captain Lexington on Sun 20/05/2007 00:13:49
For Usermode 1, did you select 'Standard Cursor Mode?'

As for you second question, all you need to do is make a hotspot that covers the entire room, and handle the click under the Usermode 1 tab in the interaction editor for each room. Simple enough.
Title: Re: custom cursor
Post by: Khris on Sun 20/05/2007 06:50:31
I'd catch the click in on_mouse_click.

...
  if (button==eMouseLeft) {
    if (mouse.Mode==eModeUsermode1) {
      int x=player.Room;
      if (x==1) Display("...");
      else if (x==2) Display("...");
      ...
    }
    else ProcessClick(...
Title: Re: custom cursor
Post by: Captain Lexington on Sun 20/05/2007 07:40:00
I knew there was a less clumsy method. *snaps fingers*

Live and Learn.
Title: Re: custom cursor
Post by: Gepard on Sun 20/05/2007 10:43:21
I tried to do it with that on_mouse_click, but when I put the code in, than tried to save the game, an error occured: "Nested functions not supported." The problem was in the second line of this code, which is just under the on_mouse_click code:

#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button)
  {
  }
Title: Re: custom cursor
Post by: Dan_N on Sun 20/05/2007 10:50:52
You probably forgot a closing bracket. Recheck.
Title: Re: SOLVED custom cursor
Post by: Gepard on Sun 20/05/2007 12:13:15
So I finally solved it in a different way, but I couldnt do it without the code. Thank you and thank you all.
Title: Re: SOLVED custom cursor
Post by: Khris on Sun 20/05/2007 16:09:16
Could you post the code you've used? Just curious :)
Title: Re: SOLVED custom cursor
Post by: Gepard on Mon 21/05/2007 10:24:27
I just used "any click on (player) character"

and the code looks like this:

    if (mouse.Mode==eModequestion) {
      int x=player.Room;
      if (x==4) Display ("TEXT");
      if (x==7) {
      if (GetGlobalInt(3) == 0) {
      Display ("TEXT");
}
      if (GetGlobalInt(3) == 1) {
         Display ("TEXT");
}
      if (x==9) Display("TEXT");
}
}
Title: Re: SOLVED custom cursor
Post by: Khris on Mon 21/05/2007 15:22:21
This code won't work in room 9.
Indent your code properly, then you'll make way less mistakes with the braces:

  if (mouse.Mode==eModequestion) {
    int x=player.Room;
    if (x==4) Display ("TEXT");
    if (x==7) {
      if (GetGlobalInt(3) == 0) {
        Display ("TEXT");
      }
      if (GetGlobalInt(3) == 1) {
        Display ("TEXT");
      }
      if (x==9) Display("TEXT");
    }
  }

As you can see, the "if (x==9)" line belongs further outside.
Title: Re: SOLVED custom cursor
Post by: Gepard on Mon 21/05/2007 15:57:33
Yep! Youre right!

I didnt notice. I would be looking for this mistake forever :f)

Thanks.