LucasArts GUI Help Thread (NEW Scumm GUI Available!)

Started by TerranRich, Fri 01/08/2003 06:04:47

Previous topic - Next topic

Lazarus

One thing I have noticed is with the status line,
in that for example. If you give a character an inventory item and this in turn causes the player to change room, in the new room it will briefly show that you have given an inventory item to a character.

So what I then did was to give the status label a script name "lblStatus" and then add to the on event function the following:
Code: ags

function on_event (int event, int data) {//////////////////////////////////////On Event/////////////////////On Event
Ã,  if (event == eEventEnterRoomBeforeFadein) player.PlaceOnWalkableArea();

Ã,  else if (event == eEventLeaveRoom) { // Reset Label to "walk to".
Ã,  Ã,  SetDefaultMode(WALK);
Ã,  Ã,  lblStatus.Text = ("Walk to");
Ã,  }

}


which seems to have solved the problem.
*Currently using AGS Editor 2.70 (Build 2.70.601)*

SSH

I've updated the zip with your change, Lazarus. Thanks again.
12

Glockenspiel

I'm sorry if this has been answered, but I'm pretty new in terms of scripting in AGS (my best works include calling/hiding GUIs and moving objects). Can anyone give me a fast method on how to implement only the status bar from Lucas Arts GUIs? The MI2 template includes all of the buttons and such, and I can't understand one bit of the scripting. I've made fair progress on my project and don't wish to start over using the MI2 template as a, well, template!

Answers would be appreciated...

SSH

Use my Description module http://ssh.me.uk/modules/Description.zip

instructions are in the module header, or search the forums for the thread...
12

Glockenspiel

Quote from: SSH on Sun 27/08/2006 08:19:31
Use my Description module http://ssh.me.uk/modules/Description.zip

instructions are in the module header, or search the forums for the thread...
Many thanks. This is exactly what I'm looking for!

Mats Berglinn

Could someone make a 2.72 version of the Day of the Tentacle template, please?

cjhrules

#346
I have some problems with the "GIVE" command. When I use it nothing happen not even the "default" message "I'd rather keepit ." displays. What can be the problem.
It's used on chracters of course so that's no the problem.

EDIT: Ok, I solved it. I had to put the command in the "Any click" section.

god

#347
Hey, new member here, currently working on a new game, some of it is built already and ive recently found out about these gui templates. so i tried one of the MI2 ones out. encountering a few problems, the first one was the 'gInventory' , i think its sorted now, i checked out some previous posts, the next one is the SetMode problem..

#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {

  String buffer;
  if (interface == MAINGUI) {

//   Setting cursor modes:
//-----------------------------------------------------
    if (button == 0)  SetMode(GIVE);    ( <-- line 76)
    if (button == 1)  SetMode(PICKUP);
    if (button == 2)  SetMode(USE);
    if (button == 3)  SetMode(OPEN);
    if (button == 4)  SetMode(LOOK);
    if (button == 5)  SetMode(PUSH);
    if (button == 6)  SetMode(CLOSE);
    if (button == 7)  SetMode(TALK);
    if (button == 8 )  SetMode(PULL);
//-----------------------------------------------------
______________________________________________________________

..It says "There was an error compliling your script. The problem was: In:'Global script'

Error(line 76): Undefined token 'SetMode'

Do you want to fix the script now?9Your game has not been saved."
_______________________________________________
ive been reading over loads of previous posts and i cant seem to work out what it is, if anyone coudl shed some light on this then it'd be most appreciated!Thanks!

Ashen

undefined token errors mean the thing you're trying to use (in this case the function SetMode) doesn't exist.
Are you using the template as-is, or have you copied some code over to another game? Since that's only line 76, I'd guess you're missing a whole lot of the template code before that point. NOTE: functions and variables have to have been created before - i.e. earlier in the script than - they're used, so if the declaration for SetMode is there, but starts at line 90, you'd still get that error.
I know what you're thinking ... Don't think that.

god

#349
yeah i copied exported the code, then imported it into my own one, do you know at all what i am missing from my script then? would it be difficult to fix?

// 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
  // switch to the Use cursor (to select items with)
  mouse.Mode = eModeInteract;
  // But, override the appearance to look like the arrow
  mouse.UseModeGraphic(eModePointer);

}

#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(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 );
  }
  else {   // right-click, so cycle cursor
    mouse.SelectNextMode();
  }
}
#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) {

  String buffer;
  if (interface == MAINGUI) {

//   Setting cursor modes:
//-----------------------------------------------------
    if (button == 0)  SetMode(GIVE);
    if (button == 1)  SetMode(PICKUP);
    if (button == 2)  SetMode(USE);
    if (button == 3)  SetMode(OPEN);
    if (button == 4)  SetMode(LOOK);
    if (button == 5)  SetMode(PUSH);
    if (button == 6)  SetMode(CLOSE);
    if (button == 7)  SetMode(TALK);
    if (button == 8 )  SetMode(PULL);
//-----------------------------------------------------

//   Scrolling the inventory:
//-----------------------------------------------------
    if ((button == 10))
      MainInventory.ScrollDown();
    if ((button == 9))
      MainInventory.ScrollUp();
    }
//-----------------------------------------------------

//   Options GUI
//-----------------------------------------------------
if (interface == OPTIONS) {
    if (button == 0){ //save game
      gOptions.Visible=0;
      GetLucasSavegameListBox(SAVE,1); // fills listbox 1 on gui SAVE with saved games
      gSave.Visible=1;
      }
    if (button == 1){ //load game
      gOptions.Visible=0;
      GetLucasSavegameListBox(RESTORE,1);
      gRestore.Visible=1;
      }
    if (button == 2){ // continue playing
      gOptions.Visible=0;
      }
    if (button == 3){ // exit??
      gConfirmexit.Visible=1;
      }
    }
//-----------------------------------------------------

//   Restore game GUI
//-----------------------------------------------------
if (interface == RESTORE) {
    if (button ==2) gRestore.Visible=0; //cancel
    if (button ==1){ //click on listbox item
       int index = gRestore.Controls[1].AsListBox.SelectedIndex;
       buffer=Game.GetSaveSlotDescription(index+100);
       if (buffer!=null){ //if there is a savegame here
         gRestore.Visible=0;
         RestoreGameSlot(index+100);
        }
       }     
    if (button == 3){ //scroll up
         if (GStopsaveitem<5) GStopsaveitem=0;
         else GStopsaveitem-=5;
         gRestore.Controls[1].AsListBox.TopItem=GStopsaveitem;
      }
    if (button == 4 && GStopsaveitem<90) //scroll down
      GStopsaveitem+=5;
         gRestore.Controls[1].AsListBox.TopItem=GStopsaveitem;
    }
//-----------------------------------------------------

//   Save game GUI
//-----------------------------------------------------

if (interface == SAVE){
    int index=gSave.Controls[1].AsListBox.SelectedIndex;
    if (button == 3){//cancel
      gSave.Visible=0;
      gSavetextbox.Visible=0;
    }
    if (button == 1){ //click on listbox
     int stbypos;
      gSavetextbox.Controls[1].AsLabel.Text=String.Format("%d", index+1);
      buffer=Game.GetSaveSlotDescription(index+100);
      if (buffer==null) buffer="";//GetSaveSlotDescription(index+100,buffer);
       gSavetextbox.Controls[0].AsTextBox.Text=buffer;
     stbypos=28+((index-GStopsaveitem)*(DEFAULT_FONT_HEIGHT+2)); //28 is set by trial-error. Deppends of the savegames listbox position
     if (index<9) { gSavetextbox.Controls[0].X=12; gSavetextbox.Controls[0].Y=0; }
     else { gSavetextbox.Controls[0].X=18; gSavetextbox.Controls[0].Y=0; }
     gSavetextbox.X=29;
     gSavetextbox.Y=stbypos;
     gSavetextbox.Visible=1;
    }
    if (button == 2 && index>=0) { //save
      buffer=gSavetextbox.Controls[0].AsTextBox.Text;
      gSave.Visible=0;
      gSavetextbox.Visible=0;
      SaveGameSlot(index+100,buffer);
    }
    if (button == 4){// scroll up
       gSavetextbox.Visible=0;
       gSave.Controls[1].AsListBox.SelectedIndex=-1;
         if (GStopsaveitem<5) GStopsaveitem=0;
         else GStopsaveitem-=5;
          gSave.Controls[1].AsListBox.TopItem=GStopsaveitem;
    }
    if (button == 5 && GStopsaveitem<90){ //scroll down
       gSavetextbox.Visible=0;
       gSave.Controls[1].AsListBox.SelectedIndex=-1;
       GStopsaveitem+=5;
          gSave.Controls[1].AsListBox.TopItem=GStopsaveitem;
    }
  }
if (interface == SAVETEXTBOX){
    int index=gSave.Controls[1].AsListBox.SelectedIndex;
    if (button == 0){
      buffer=gSavetextbox.Controls[0].AsTextBox.Text;
      gSave.Visible=0;
      gSavetextbox.Visible=0;
      SaveGameSlot(index+100,buffer);
    }
    if (mouse.IsButtonDown(eMouseRight)) gSavetextbox.Visible=0;
}
//-----------------------------------------------------

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


#sectionstart btnInvUp_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnInvUp_Click(GUIControl *control, MouseButton button) {
  invCustomInv.ScrollUp();
}
#sectionend btnInvUp_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnInvDown_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnInvDown_Click(GUIControl *control, MouseButton button) {
  invCustomInv.ScrollDown();
}
#sectionend btnInvDown_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnInvOK_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnInvOK_Click(GUIControl *control, MouseButton button) {
 
   // They pressed the OK button, close the GUI
   gInventory.Visible = false;
   mouse.UseDefaultGraphic();
}
#sectionend btnInvOK_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnInvSelect_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnInvSelect_Click(GUIControl *control, MouseButton button) {
 
   // They pressed SELECT, so switch to the Get cursor
   mouse.Mode = eModeInteract;
   // But, override the appearance to look like the arrow
   mouse.UseModeGraphic(eModePointer);
}
#sectionend btnInvSelect_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnIconInv_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnIconInv_Click(GUIControl *control, MouseButton button) {
 
  show_inventory_window();
}
#sectionend btnIconInv_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnIconCurInv_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnIconCurInv_Click(GUIControl *control, MouseButton button) {
 
  if (player.ActiveInventory != null)
    mouse.Mode = eModeUseinv;
}
#sectionend btnIconCurInv_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnIconSave_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnIconSave_Click(GUIControl *control, MouseButton button) {
 
  SaveGameDialog();
}
#sectionend btnIconSave_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnIconLoad_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnIconLoad_Click(GUIControl *control, MouseButton button) {
 
  RestoreGameDialog();
}
#sectionend btnIconLoad_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnIconExit_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnIconExit_Click(GUIControl *control, MouseButton button) {
 
  QuitGame(1);
}
#sectionend btnIconExit_Click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart btnIconAbout_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnIconAbout_Click(GUIControl *control, MouseButton button) {
 
  Display("Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2005 Chris Jones");
}
#sectionend btnIconAbout_Click  // DO NOT EDIT OR REMOVE THIS LINE



much appreciated thanks!

Khris

By default, there's no SetMode function in AGS, nor does AGS know what GIVE means.
Exporting and importing a short bit of code from the template won't work at all, I'm afraid. You'd have to sort out exactly which portions are needed and copy over all of them.

Why don't you just use the complete template and alter it to fit your needs?

Lazarus

Hi I'm having a go with updating the DOTT template to use with ags 2.72, I'm wanting to use the enforce object based scripting and enforce new style strings and was wondering how you upate the following code.
Code: ags

function SetPlayer(int charid){
Ã,  //use this instead of SetPlayerCharacter function for switching to other players
Ã,  int counter=1;
Ã,  while (counter<MAX_PLAYERS){
Ã,  Ã,  if (charid==Tposition[counter].charac){
Ã,  Ã,  Ã,  SetButtonPic(MAINGUI,Tposition[counter].smallpicbutton,1,Tplayer[GetPlayerCharacter()].smallpic);
Ã,  Ã,  Ã,  Tposition[counter].charac=GetPlayerCharacter();
Ã,  Ã,  }
Ã,  Ã,  SetButtonPic(MAINGUI,Tposition[counter].smallpicbevelbutton,1,Tplayer[charid].smallpicbevel);
Ã,  Ã,  counter++;
Ã,  }
Ã,  Tposition[0].charac=charid;
Ã,  counter=0;Ã,  Ã, 
Ã,  while (counter<MAX_MODES){
Ã,  Ã,  if (Tmode[counter].button[charid]>=0) SetButtonPic(MAINGUI,Tmode[counter].button[charid],2,Tmode[counter].highlightedbutton[charid]);
Ã,  Ã,  counter++;
Ã,  }
Ã,  SetLabelColor(ACTION,0,Tplayer[charid].actionlabelcolor);

Ã,  Tplayer[GetPlayerCharacter()].topinvitem=game.top_inv_item;
Ã,  if (Tplayer[charid].topinvitem>=0) game.top_inv_item=Tplayer[charid].topinvitem;

Ã,  SetCharacterClickable(GetPlayerCharacter(),1);
Ã,  SetCharacterClickable(charid,0);
Ã,  StopMoving(GetPlayerCharacter());
Ã,  SetPlayerCharacter(charid);
Ã,  SetMode(DEFAULT);

}


I get an error with the "SetButtonPic" undefined token.
Any help would be grateful
*Currently using AGS Editor 2.70 (Build 2.70.601)*

Ashen

#352
The error (as you can probably guess) means you're trying to use an old-style command (SetButtonPic) which is now obsolete. (Leaving 'Enforce object-based scripting' unchecked tells AGS it can still use the obsolete functions, but you're right that it's better to phase them out.)

You can use the manual to help you with this type of error - select the old command in the 'Index' tab, and you should be taken to the OO equivilant. In this case, there are three properties that replace it: Button.NormalGraphic, Button.MouseOverGraphic and Button.PushedGraphic, depending on the which parameter (the 3rd one) used in the SetButtonPic commands.
1 = NormalGraphic, 2 = MouseOver, 3 = Pushed.

Code: ags

SetButtonPic(MAINGUI,Tposition[counter].smallpicbutton,1,Tplayer[GetPlayerCharacter()].smallpic);


which = 1, so that would be:
Code: ags

gMaingui.Controls[Tposition[counter].smallpicbutton].AsButton.NormalGraphic = Tplayer[player.ID].smallpic; // 'GetPlayerCharacter()' is also obsolete


You might be better changing the Tposition[counter].smallpicbutton variable to a Button pointer, allowing the slightly shorter:
Code: ags

Tposition[counter].smallpicbutton.NormalGraphic = Tplayer[player.ID].smallpic;
I know what you're thinking ... Don't think that.

Lazarus

#353
I tried your shortened version of
Code: ags

Tposition[counter].smallpicbutton.NormalGraphic = Tplayer[player.ID].smallpic;

and this gave an error stating NormalGraphic is not a member of "int". So I used your second version which seems to work.

My next problem is with this code
Code: ags

if (Tmode[counter].button[charid]>=0) SetButtonPic(MAINGUI,Tmode[counter].button[charid],2,Tmode[counter].highlightedbutton[charid]);

I've tried this code below, but I get a Parse error in expr near "Tmode"
Code: ags

if (Tmode[counter].button[charid]>=0) gMaingui.Controls[Tmode[counter].button[charid]].AsButton.MouseOverGraphic = Tmode[counter].highlightedbutton[charid]);

I know I'm missing something but I cannot see it

*Edit*
Also would I be right with changing
Code: ags

Ã,  SetLabelColor(ACTION,0,Tplayer[charid].actionlabelcolor);

Ã,  Tplayer[GetPlayerCharacter()].topinvitem=game.top_inv_item;
Ã,  if (Tplayer[charid].topinvitem>=0) game.top_inv_item=Tplayer[charid].topinvitem;

Ã,  SetCharacterClickable(GetPlayerCharacter(),1);
Ã,  SetCharacterClickable(charid,0);
Ã,  StopMoving(charid);
Ã,  SetPlayerCharacter(charid);

To this
Code: ags

Ã,  labelStatus.TextColor = Tplayer[charid].actionlabelcolor;

Ã,  Tplayer[charid].topinvitem=MainInventory.TopItem;// MainInventory script name.
Ã,  if (Tplayer[charid].topinvitem>=0) MainInventory.TopItem=Tplayer[charid].topinvitem;

Ã,  character[player.ID].Clickable = 1;// Yes
Ã,  character[charid].Clickable = 0;Ã,  Ã, // No
Ã,  player.StopMoving();
Ã,  character[charid].SetAsPlayer();
Ã,  SetMode(DEFAULT);

*Currently using AGS Editor 2.70 (Build 2.70.601)*

Ashen

Quote
I tried your shortened version of
...
and this gave an error stating NormalGraphic is not a member of "int". So I used your second version which seems to work.

Did you also change smallpicbutton variable (in the struct the Tposition refers to) into a Button pointer? If so, it makes no sense that the 'short' version doesn't work, and the 'long' version does. If not - there's your problem. There's no real need to do it that way, it'll just save a little bit of typing, and make the code look a little more OO-like.

Code: ags

My next problem is with this code
...
I've tried this code below, but I get a Parse error in expr near "Tmode"
...
I know I'm missing something but I cannot see it


It looks like you've got a stray ) at the end of the line - Tmode[counter].highlightedbutton[charid]);.

Quote
Also would I be right with changing
...
To this

Looks good, but:
Code: ags

  Tplayer[charid].topinvitem=MainInventory.TopItem;// MainInventory script name.

The original line uses GetPlayerCharacter, so shouldn't that be:
Code: ags

  Tplayer[player.ID].topinvitem=MainInventory.TopItem;// MainInventory script name.


And:
Code: ags

  character[player.ID].Clickable = 1;// Yes

Would work fine, but why not just:
Code: ags

  player.Clickable = 1;// Yes
I know what you're thinking ... Don't think that.

Lazarus

Great that fixed that problem.
Now my next problem seems to be with the new "Strings" commands.
I have this code and it's saying "undefined token GetInvName"
here's the function in question
Code: ags

function GiveInv(int invitem, int charid){
Ã,  String invname;
Ã,  GetInvName(invitem,invname);

Ã,  character[charid].inv[invitem]=character[GetPlayerCharacter()].inv[invitem];
Ã,  character[GetPlayerCharacter()].inv[invitem]=0;
Ã,  UpdateInventory();
Ã,  character[GetPlayerCharacter()].activeinv=invitem;

Ã,  GSloctype=0;
Ã,  RunCharacterInteraction(charid, MODE_USEINV);
}

Also would I be right with using this code?
Code: ags

Ã,  character[charid].inv[invitem]=player.ID.inv[invitem];
Ã,  player.ID.inv[invitem]=0;
Ã,  UpdateInventory();
Ã,  player.ID.activeinv=invitem;

*Currently using AGS Editor 2.70 (Build 2.70.601)*

SSH

Err, the invname is not actually being used at all so that code is redundant anyway.

and character[GetPlayerCharacter()] can just be replaced by player
12

Lazarus

#357
How do you mean? just leave out "invname" or the whole function?
If it's just the "invname" do you mean so that all that is left would be something like
Code: ags

 function GiveInv(int invitem, int charid){
Ã,  character[charid].inv[invitem]=player.ID.inv[invitem];
Ã,  player.ID.inv[invitem]=0;
Ã,  UpdateInventory();
Ã,  player.ID.activeinv=invitem;

Ã,  GSloctype=0;
Ã,  RunCharacterInteraction(charid, MODE_USEINV);
}

*Edit*
As this is also linked to this function
Code: ags

function GiveInvChronOJohn(int invitem, int charid){
Ã,  String invname;
Ã,  GetInvName(invitem, invname);
Ã,  if (ExtensionEx(3,invname)!='d') {
Ã,  Ã,  GSmode=GIVECHRON;
Ã,  Ã,  GSusedmode=GIVECHRON;
Ã,  Ã,  SetGraphicalVariable("Used Mode", GIVECHRON);
Ã,  Ã,  GiveInv(invitem, charid);
Ã,  Ã,  SetMode(DEFAULT);
Ã,  }
Ã,  else {
Ã,  //you could put here different messages or actions for different items when the player
Ã,  //tries to give them via the chron-o-john (i.e. the little icons in the GUI)
Ã,  //and it doesnt do the default behaviour (giving the item), because the second extension of 
Ã,  //that inventory item is 'd'.
Ã,  Ã,  if (invitem==2) Display("The hamster wouldn't survive to a Chron-O-John travel");//if tried to give the hamster
Ã,  Ã,  else Display ("I think i can't put that in the Chron-O-John"); //generic message
Ã,  }
}

which would be the next problem.
*Currently using AGS Editor 2.70 (Build 2.70.601)*

SSH

ew, this code looks a real mess. I'd rewrite it from scratch... ;)

Code: ags

 function GiveInv(InventoryItem *invitem, Character *charid){
  charid.InventoryQuantity[invitem.ID]=player.InventoryQuantity[invitem.ID];
  player.InventoryQuantity[invitem.ID]=0;
  UpdateInventory();
  player.ActiveInventory=null;

  GSloctype=0;
  charid.RunInteraction(eModeUseInv);
}

12

Lazarus

How would I change this function as it is also linked with the "function GiveInv(InventoryItem *invitem, Character *charid){"

Code: ags

function GiveInvChronOJohn(int invitem, int charid){
Ã,  String invname;
Ã,  GetInvName(invitem, invname);
Ã,  if (ExtensionEx(3,invname)!='d') {
Ã,  Ã,  GSmode=GIVECHRON;
Ã,  Ã,  GSusedmode=GIVECHRON;
Ã,  Ã,  SetGraphicalVariable("Used Mode", GIVECHRON);
Ã,  Ã,  GiveInv(invitem, charid);
Ã,  Ã,  SetMode(DEFAULT);
Ã,  }
Ã,  else {
Ã,  //you could put here different messages or actions for different items when the player
Ã,  //tries to give them via the chron-o-john (i.e. the little icons in the GUI)
Ã,  //and it doesnt do the default behaviour (giving the item), because the second extension of 
Ã,  //that inventory item is 'd'.
Ã,  Ã,  if (invitem==2) Display("The hamster wouldn't survive to a Chron-O-John travel");//if tried to give the hamster
Ã,  Ã,  else Display ("I think i can't put that in the Chron-O-John"); //generic message
Ã,  }
}


Thanks in advance
*Currently using AGS Editor 2.70 (Build 2.70.601)*

SMF spam blocked by CleanTalk