Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Sat 15/05/2010 23:02:41

Title: Cursor cycle reordering?
Post by: Knox on Sat 15/05/2010 23:02:41
I have my right-click mouse button set to cycle through my cursors in "on_mouse_click":
 
   if (button == eMouseRight)
   {
       mouse.SelectNextMode();
   }


Right now, when I right-click to cycle, this is how the cursor order is cycled (# on the left is the mouse ID):

Current sequence:

0-Walk
1-Look
2-Interact
3-Question
4-Use Inv
5-Command
6-Run

However, I would rather have the run cursor come right after the "walk" cursor and the "use inventory" cursor as the last option as I cycle with the right-click.

Ive searched the manual and it seems IIANM the mouse ID cannot be changed...so how would I "reorder" the sequence so that I get the new result when I cycle through cursors with the right-mouse button?

New sequence:
0-Walk
6-Run
1-Look
2-Interact
3-Question
5-Command
4-Use Inv


Title: Re: Cursor cycle reordering?
Post by: Calin Leafshade on Sun 16/05/2010 00:00:29
the most simple way to do it is to  have some else ifs like


if(mouse.mode == 0) mouse.mode = 6;
else if(mouse.mode == 6) mouse.mode = 1;


and so on.
Title: Re: Cursor cycle reordering?
Post by: Knox on Sun 16/05/2010 00:22:25
Hey Calin!

That's incredibly simple, for some reason I thought I "had" to use the "SelectNextMode"!

Ok, here's what I did and it works great:


      {
        if(mouse.Mode == 0) mouse.Mode = 13;
        else if(mouse.Mode == 13) mouse.Mode = 1;
        else if(mouse.Mode == 1) mouse.Mode = 2;
        else if(mouse.Mode == 2) mouse.Mode = 3;
        else if(mouse.Mode == 3) mouse.Mode = 8;
        else if(mouse.Mode == 8)
        {
          if (player.ActiveInventory != null)
          mouse.Mode = 4;
          else
          {
            mouse.Mode = 0;
          }
        }
        else if(mouse.Mode == 4) mouse.Mode = 0;
        //mouse.SelectNextMode();
      }


I just made sure if there is no active inventory item to skip that cursor.

Thanks :)