walking- solved

Started by viktor, Mon 02/08/2004 21:26:05

Previous topic - Next topic

viktor

Hy. I'm back. I hawe a little problem. I hawe this monkey island/dott  stile gui and it dosn't contain a walk to option. The game realy needs that now dosn't it. Here are all the scripts:

Code: ags
  // this GUI system uses GlobalInt 80 to store which of the extended
  // modes is in use (close, give, push, pull, etc)

  if (interface == 0) {
    if (button == 8) {   // give
      SetGlobalInt(80,2);
      }
    if (button == 1) {   // open
      SetCursorMode(8);
      SetGlobalInt(80,3);
      }
    if (button == 2) {   // look at
      SetCursorMode(1);
      SetGlobalInt(80,8);
      }
    if (button == 3) {   // use
      SetCursorMode(2);
      SetGlobalInt(80,7);
      }
    if (button == 4) {   // close
      SetCursorMode(8);
      SetGlobalInt(80,1);
      }   
    if (button == 5) {   // push
      SetCursorMode(8);
      SetGlobalInt(80,4);
      }
    if (button == 6) {   // take
      SetCursorMode(5);
      SetGlobalInt(80,6);
      }
    if (button == 7) {   // talk to
      SetCursorMode(3);
      SetGlobalInt(80,9);
      }
    if (button == 8) {   // pull
      SetCursorMode(8);
      SetGlobalInt(80,5);
      }

    if ((button == 10) & (game.top_inv_item < game.num_inv_items - 7))
      game.top_inv_item = game.top_inv_item + 4;
    if ((button == 9) & (game.top_inv_item > 0))
      game.top_inv_item = game.top_inv_item - 4;
    }


I would like to replace the GIVE option with a WALKT TO option. What do I hawe to change?
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ashen

#1
Ã,  Ã, if (button == 8 ) {Ã,  Ã, // give
Ã,  Ã,  Ã,  SetGlobalInt(80,2);
Ã,  Ã,  Ã,  }

to

Ã,  Ã, if (button == 8 ) {Ã,  Ã, // walk
Ã,  Ã,  Ã,  SetCursorMode (0);
Ã,  Ã,  Ã,  }

I think, but I'm not really familiar with how that GUI works. I did notice, however, that button 8 sets both 'give' and 'pull' modes. Should one of them beÃ,  'if (button == 0) {' ? Hope this helps.
I know what you're thinking ... Don't think that.

viktor

#2
QuoteI think, but I'm not really familiar with how that GUI works. I did notice, however, that button 8 sets both 'give' and 'pull' modes. Should one of them be  'if (button == 0) {' ? Hope this helps.

Hm...
I didn't notice that before. Thanks for warning me. You see I downloaded this GUI from the net so I'm not realy shure why it is set up this way.
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

viktor

it dosn't work...
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Proskrito

QuoteYou see I downloaded this GUI from the net so I'm not realy shure why it is set up this way.
if its lucasfans monkey 2 template, i think you had to right click to get "walk" mode, but anyways, do as ashen says and it should work.

viktor

Well it should but it dosn't.

here is the problem:


and here is the main script:
Code: ags
// main global script file

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
  // called when the game starts, before the first room is loaded
}
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  // put anything you want to happen every game cycle here
}
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE


function show_inventory_window () {
  // This demonstrates both types of inventory window - the first part is how to
  // show the built-in inventory window, the second part uses the custom one.
  // Un-comment one section or the other below.
  
  // ** DEFAULT INVENTORY WINDOW
  InventoryScreen();
/*  
  // ** CUSTOM INVENTORY WINDOW
  GUIOn (INVENTORY);  
  // switch to the Use cursor (to select items with)
  SetCursorMode (MODE_USE);
  // But, override the appearance to look like the arrow
  SetMouseCursor (6);
*/
}

#sectionstart on_key_press  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {
  // called when a key is pressed. keycode holds the key's ASCII code
  if (IsGamePaused() == 1) keycode=0;  // game paused, so don't react to keypresses
  if (keycode==17)  QuitGame(1);   // Ctrl-Q
  if (keycode==363) SaveGameDialog();   // F5
  if (keycode==365) RestoreGameDialog();  // F7
  if (keycode==367) RestartGame();  // F9
  if (keycode==434) SaveScreenShot("scrnshot.bmp");  // F12
  if (keycode==9)   show_inventory_window();  // Tab, show inventory

  if (keycode==19)  Debug(0,0);  // Ctrl-S, give all inventory
  if (keycode==22)  Debug(1,0);  // Ctrl-V, version
  if (keycode==1)   Debug(2,0);  // Ctrl-A, show walkable areas
  if (keycode==24)  Debug(3,0);  // Ctrl-X, teleport to room
}
#sectionend on_key_press  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int 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==LEFT) {
    ProcessClick(mouse.x, mouse.y, GetCursorMode() );
  }
  else {   // right-click, so cycle cursor
    SetNextCursorMode();
  }
}
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
 // this GUI system uses GlobalInt 80 to store which of the extended
  // modes is in use (close, give, push, pull, etc)

  if (interface == 0) {
     if (button == 8 ) {   // walk
      SetCursorMode (0);
      }
    if (button == 1) {   // open
      SetCursorMode(8);
      SetGlobalInt(80,3);
      }
    if (button == 2) {   // look at
      SetCursorMode(1);
      SetGlobalInt(80,8);
      }
    if (button == 3) {   // use
      SetCursorMode(2);
      SetGlobalInt(80,7);
      }
    if (button == 4) {   // close
      SetCursorMode(8);
      SetGlobalInt(80,1);
      }   
    if (button == 5) {   // push
      SetCursorMode(8);
      SetGlobalInt(80,4);
      }
    if (button == 6) {   // take
      SetCursorMode(5);
      SetGlobalInt(80,6);
      }
    if (button == 7) {   // talk to
      SetCursorMode(3);
      SetGlobalInt(80,9);
      }
    if (button == 8) {   // pull
      SetCursorMode(8);
      SetGlobalInt(80,5);
      }

    if ((button == 10) & (game.top_inv_item < game.num_inv_items - 7))
      game.top_inv_item = game.top_inv_item + 4;
    if ((button == 9) & (game.top_inv_item > 0))
      game.top_inv_item = game.top_inv_item - 4;
    }

#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE

signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Gilbert

You missed one } at the end of interface_click at least, try adding that first.

viktor

I checked and can't find the part where I mised it. But howcome it's mising now? Before I added the walk to part it worked fine...
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Gilbert

Just add the } as mentioned.
#sectionstart interface_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
 // this GUI system uses GlobalInt 80 to store which of the extended
Ã,  // modes is in use (close, give, push, pull, etc)

Ã,  if (interface == 0) {
Ã,  Ã,  Ã, if (button == 8 ) {Ã,  Ã, // walk
Ã,  Ã,  Ã,  SetCursorMode (0);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 1)Ã,  {Ã,  Ã, // open
Ã,  Ã,  Ã,  SetCursorMode(8);
Ã,  Ã,  Ã,  SetGlobalInt(80,3);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 2)Ã,  {Ã,  Ã, // look at
Ã,  Ã,  Ã,  SetCursorMode(1);
Ã,  Ã,  Ã,  SetGlobalInt(80,8);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 3)Ã,  {Ã,  Ã, // use
Ã,  Ã,  Ã,  SetCursorMode(2);
Ã,  Ã,  Ã,  SetGlobalInt(80,7);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 4)Ã,  {Ã,  Ã, // close
Ã,  Ã,  Ã,  SetCursorMode(8);
Ã,  Ã,  Ã,  SetGlobalInt(80,1);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 5)Ã,  {Ã,  Ã, // push
Ã,  Ã,  Ã,  SetCursorMode(8);
Ã,  Ã,  Ã,  SetGlobalInt(80,4);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 6)Ã,  {Ã,  Ã, // take
Ã,  Ã,  Ã,  SetCursorMode(5);
Ã,  Ã,  Ã,  SetGlobalInt(80,6);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 7)Ã,  {Ã,  Ã, // talk to
Ã,  Ã,  Ã,  SetCursorMode(3);
Ã,  Ã,  Ã,  SetGlobalInt(80,9);
Ã,  Ã,  Ã, Ã,  }
Ã,  Ã,  if (button == 8)Ã,  {Ã,  Ã, // pull
Ã,  Ã,  Ã,  SetCursorMode(8);
Ã,  Ã,  Ã,  SetGlobalInt(80,5);
Ã,  Ã,  Ã, Ã,  }

Ã,  Ã,  if ((button == 10) & (game.top_inv_item < game.num_inv_items - 7))Ã,  game.top_inv_item = game.top_inv_item + 4;
Ã,  Ã,  if ((button == 9) & (game.top_inv_item > 0))Ã,  Ã,  game.top_inv_item = game.top_inv_item - 4;
Ã,  Ã,  }
} //<-- Add this back
#sectionend interface_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

Proskrito

and also, instead of:
 if (interface == 0) {
     if (button == 8 ) {   // walk
      SetCursorMode (0);
       }

i think you have to write:
 if (interface == 0) {
     if (button == 0 ) {   // walk
      SetCursorMode (0);
       }

because button 8 seems to be used for pull in you script

viktor

Ok. Now It works. THANKS! I hawe a nothr question with the same GUI though. When I go over the hotspot I would like the name of that hotspot to be diplayed. What do I hawe to add to the GUI and the script to make this work
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ashen

You just need to add a label on the GUI and set its text to @OVERHOTSPOT@
I know what you're thinking ... Don't think that.

viktor

Quote from: Ashen on Wed 04/08/2004 14:30:35
You just need to add a label on the GUI and set its text to @OVERHOTSPOT@

Oh? Cool. Didn't know it was so easy. Thanks a bunch.
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

SMF spam blocked by CleanTalk