SOLVED custom cursor

Started by Gepard, Sat 19/05/2007 23:12:26

Previous topic - Next topic

Gepard

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.
Drink up me 'arties! Yo ho!

Captain Lexington

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.

Khris

I'd catch the click in on_mouse_click.

Code: ags
...
  if (button==eMouseLeft) {
    if (mouse.Mode==eModeUsermode1) {
      int x=player.Room;
      if (x==1) Display("...");
      else if (x==2) Display("...");
      ...
    }
    else ProcessClick(...

Captain Lexington

I knew there was a less clumsy method. *snaps fingers*

Live and Learn.

Gepard

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)
  {
  }
Drink up me 'arties! Yo ho!

Dan_N

You probably forgot a closing bracket. Recheck.

Gepard

So I finally solved it in a different way, but I couldnt do it without the code. Thank you and thank you all.
Drink up me 'arties! Yo ho!

Khris

Could you post the code you've used? Just curious :)

Gepard

#8
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");
}
}
Drink up me 'arties! Yo ho!

Khris

This code won't work in room 9.
Indent your code properly, then you'll make way less mistakes with the braces:

Code: ags
  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.

Gepard

Yep! Youre right!

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

Thanks.
Drink up me 'arties! Yo ho!

SMF spam blocked by CleanTalk