The ultimate Cursor [Solved]

Started by Caracal, Fri 06/07/2012 10:40:29

Previous topic - Next topic

Caracal

Oh ok. My global script shows this:
Code: AGS
function repeatedly_execute() {
  
  int mm = mouse.Mode;                                                     
  int lt = GetLocationType(mouse.x, mouse.y);
  int nm;
  if (lt == eLocationHotspot || lt == eLocationObject) nm = eModeInteract;
  else if (lt == eLocationCharacter) nm = eModeTalkto;
  else nm = eModeWalkto;
  if (nm != mm) mouse.Mode = nm;

  // Put here anything you want to happen every game cycle, even when
  // the game is paused. This will not run when the game is blocked
  // inside a command like a blocking Walk()
  
  if (IsGamePaused() == 1) return;

  // Put here anything you want to happen every game cycle, but not
  // when the game is paused.
}

function repeatedly_execute_always() {
  
  // Put anything you want to happen every game cycle, even
  // when the game is blocked inside a command like a
  // blocking Walk().
  // You cannot run blocking commands from this function.
  
}


On Mouse click:

Code: AGS
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
    player_loop = player.Loop;
    player_x = player.x; player_y = player_y;
    player_Room = player.Room;
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click our mouse-wheel down, so cycle cursor
   mouse.SelectNextMode();                                                                     
  }
  else if (button == eMouseMiddle) { 
    // Middle-button-click, default make character walk to clicked area (a little shortcut)
    // Could have been just "player.Walk(mouse.x,mouse.y)", but it's best to
    // leave our options open - what if you have a special script triggered
    // on "walking" mode?
    ProcessClick(mouse.x, mouse.y, eModeWalkto); 
  }
  else if (button == eMouseWheelNorth) { 
    // Mouse-wheel up, cycle cursors 
    // If mode isn't WALK, set the previous mode (notice usage of numbers instead
    // of eNums, when it suits us)...
    if (mouse.Mode>0) mouse.Mode=mouse.Mode-1; 
    else 
    { 
      // ...but if it is WALK mode...
      if (player.ActiveInventory!=null) 
      {
        //...and the player has a selected inventory item, set mouse mode to UseInv. 
        mouse.Mode=eModeUseinv; 
      }
      else 
      {
        // If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
        mouse.Mode=eModeTalkto; 
      }
    }
  }
}


And thats the Room-interact script (basically all i have done in the room script concerning this issue jet) but i suppose thats insufficien:


Code: AGS
function hHotspot1_Interact()
{
cBellatrix.Say("WAAAH!");
cBellatrix.Say("Wo bin ich hier nur gelandet?");
}

So basically i changed nothing only that i inserted the mentioned code from the other tread into my "repeadetly execute" scrip function. And thats all.

ThreeOhFour

See this:

Code: ags

    ProcessClick(mouse.x, mouse.y, mouse.Mode );
    player_loop = player.Loop;
    player_x = player.x; player_y = player_y;
    player_Room = player.Room;
    ProcessClick(mouse.x, mouse.y, mouse.Mode );


You have the ProcessClick function twice in there. That means it will process your click twice.

Delete one of these.

Caracal

Quote from: ThreeOhFour on Wed 11/07/2012 12:23:00
You have the ProcessClick function twice in there. That means it will process your click twice.

Delete one of these.

Jes! This is IT! Thank you so mutch it seems to work the way i wanted it now! How did you see that so fast, i bed i looked at the exact line at least twice and did not notice. Thank you a lot! Now i have the ultimate Kings quest cursor and nobody can stop me!!! I did not even need to learn how to apply modules and such!
Thank you very mutch.
But i am afraid that there are already other issues comming up with the death-scenes again, for which i will start a new threat, soon.

Crimson Wizard

Quote from: Caracal on Wed 11/07/2012 15:55:24
Now i have the ultimate Kings quest cursor and nobody can stop me!!! I did not even need to learn how to apply modules and such!
...
But i am afraid that there are already other issues comming up with the death-scenes again, for which i will start a new threat, soon.
Now, I know I am probably breaking the board rules, but I can't help myself and not notice that this whole paragraph on its own sounds like an introductory to the hero quest like game :D

Caracal

As amazing as the new all in one cursor is... Could it be that the "use inventory function" is negotiated by it?
I have set up an inventory item and i set up the curos image and all but somehow if i click on the inventory item in the game...
Nothing happens. My thought was that the cursor immediately changes into the "interact" mode again.
I have the idea that it might be cuz of the cusor because inventory items are actually pretty basic and there is not much that could go wrong with them. (nonetheless i do have a problem here)

SMF spam blocked by CleanTalk