Making use of all 9 verbs in the Monkey Island template.

Started by Iron Lawnmower, Sat 07/06/2014 16:51:03

Previous topic - Next topic

Iron Lawnmower

I may have screwed the pooch slightly here.
You know how the Monkey Island template has nine verbs? (Give pick-up use etc)Well when I was programming hotspots I could only program for a few of them so I went into the GUI script and did this.
Code: ags

function SetAction(Action new_action) {
  // set default action
  if (new_action == eMA_Default) new_action=default_action;
  // set corresponding cursormode
       if (new_action == eMA_WalkTo) mouse.Mode=eModeUsermode2;
  else if (new_action == eGA_LookAt) mouse.Mode=eModeLookat;
  else if (new_action == eGA_TalkTo) mouse.Mode=eModeTalkto;
  else if (new_action == eGA_GiveTo) mouse.Mode=eModeInteract;
  else if (new_action == eGA_PickUp) mouse.Mode=eModePickup;
  else if (new_action == eGA_Use)    mouse.Mode=eModeInteract;
  else if (new_action == eGA_Open)   mouse.Mode=eModeOpen;
  else if (new_action == eGA_Close)  mouse.Mode=eModeClose;
  else if (new_action == eGA_Push)   mouse.Mode=eModePush;
  else if (new_action == eGA_Pull)   mouse.Mode=eModePull;
  // save action
  global_action=new_action;

and did these functions for a hotspot EG.
Code: ags

function hHotspot1_Push()
{
cEgo.Say("Wouldn't it be cool if there was like secret treasure behind this chest of drawers that we could pay off our debt with?");
cChar1.Say("Yes it would be, Sadly the only thing that's behind that is rat feces and despair.");
}


and since I couldn't work out how to add new events under the lightning bolt icon I did this here for the "interact" event.
hHotspot1_Push  hHotspot1_Open  hHotspot1_Pull  hHotspot1_Close

But when I try and push the hotspot the game crashes saying
"Error: prepare_script: error -18 (no such function in script)trying to run 'hHotspot1_Push  hHotspot1_Open  hHotspot1_Pull  hHotspot1_C' (Room 2)"

Scavenger

You can't put more than one function name into the interaction textbox - use Other Click on Hotspot instead:

Code: AGS

function hHotspot1_Otherclick () //Instead of this, the name the interaction editor gives you.
{
if (mouse.Mode == eModePush)
{
    //Put Push interaction here.
}
else if (mouse.Mode == eModeOpen)
{
    //Do open thing.
}
else if (mouse.Mode == eModeClose)
{
    //Do close thing.
}
else if (mouse.Mode == eModePull)
{
    //Do pull thing.
}


}

Iron Lawnmower

#2
Thank you very much.

Edit:This has not fixed the issue. If I use push on the hotspot nothing happens even though I coped what you posted (Replaced the green text with what I wanted to happen of course.

Khris

You are supposed to do this:
Code: ags
function cup_AnyClick()
{
  if (MovePlayer(108, 100)) {
    // LOOK AT
    if(UsedAction(eGA_LookAt)) {
      player.Say("It's a blue cup.");
    }
    // USE
    else if(UsedAction(eGA_Use)) {
      player.Say("I'd rather pick it up.");
    }
    // Push
    else if(UsedAction(eGA_Push)) {
      player.Say("It might break.");
    }
    ...
  }
}

This works perfectly fine.
What did you try that didn't work?

Iron Lawnmower

Thank you again for helping with my stupidity. I tried what scavenger said but your code works.

SMF spam blocked by CleanTalk