LucasArts GUI Help Thread (NEW Scumm GUI Available!)

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

Previous topic - Next topic

Mats Berglinn

#260
For Caribbean Mysteries I'm using the MI2 SCUMM Template and I've encountered a strange problem:

At one point you'll need to steal a pendlum from an old man when he doesn't see that. You can trick him by putting a coin on the ground, calling the man's attention to the coin and meanwhile you take the pendlum. About ten sceonds later he will pick up the coin and return to his place.
The thing does work but there's something wrong too:

When I use the coin with the old man, the main character goes to him, the old man turns to him, then he goes to the spot where he drops the coin, stay at that spot and gets the guy's attention.

What the main character is suppoused to do is: 1) Go to the spot to drop a coin 2) Go to next to where the old man is. 3) Calling the old guy's attention toward the coin 4) Therefore the old guy turns toward the coin and walk to it. 5) The rest of the coin thing.

Code: ags

Ã,  // script for character14: Use inventory on character
MoveCharacter(EGO,600,265);
FaceLocation(EGO,600,265);
ObjectOn(3);
Wait(100);
MoveCharacter(EGO,815,265);
FaceLocation(EGO,600,265);
Wait(80);
DisplaySpeech(EGO,"Say, isn't that a coin lying on the ground?");
DisplaySpeech(HYP,"A coin? Where?");
FaceLocation(HYP,798,265);
DisplaySpeech(HYP,"Ah, there!");
MoveCharacter(HYP,798,260);
FaceLocation(HYP,600,260);
Wait(40);
int timer=0;
distract = 1;
SetTimer(1,400);

Ã,  // script for room: Repeatedly execute

if (IsTimerExpired(1)==1){
distract = 0;
ObjectOff(3);
DisplaySpeech(HYP,"Must be my lucky day.");Ã,  
MoveCharacter(HYP,900,280);

if (GetGlobalInt(11) ==1){
MoveCharacter(HYP,930,280);
Wait(40);
DisplaySpeech(HYP,"Hey, where did my pendlum go?");
}
}


Does someone know what's the problem? How do I solve this? Please help!

EDIT: Never mind, I've found the answer.

Lazarus

I'm not sure if i should be posting this here so feel free to move if not.Ã,  ;D

I can script all the buttons on the inventry (MI2 Template) ie Push, Pull etc..

The problem i have is that say i have 1 hotspot (say a rock) and 1 object (say a stick) in a room, what i would like to happen is that the player has to push the hotspot(rock) then displaying "the rock has moved abit " then allowing the player to pickup the object(stick) is this possible?

And if it is possible, then could you please help

I'm using ags version 2.7

thanks inadvance.
*Currently using AGS Editor 2.70 (Build 2.70.601)*

BernieLaraemie

I think your best bet is Global Ints and some if statements.

In game start, type:

SetGlobalInt (1, 0);

And in the rock's interaction editor, set "push" to run script, which will say:

Display("The rock has moved a bit.");
SetGlobalInt (1, 1);

ANd for the interaction editor for "pick up stick" set "run script" and type

if (getglobalint(1) == 0) display("Sorry, you can't get that!");
else [give player inventory]

I hope that works :)

~~Bernie
~~~~~
"It doesn't matter whether something is true, just that it is believed." -- Jim Morrison
~~~~~
THIS SPACE FOR RENT

Lazarus

Thanks for the reply I will certainly have ago that.

My other problem i've got is that using MI2 template I have, is that when I select another chacter on screen and the "Talk To" is highlighted and I use either the GUI button or using the right button to activate the conversation is that it doesn't work first time, I've got to press the buttons acouple of times before it works.

Any help or ideas would be grateful
*Currently using AGS Editor 2.70 (Build 2.70.601)*

Scummbuddy

To be honest, I've had that problem to with my game, Pester Quest. It isn't all that noticable, I hope, and I don't really know where the problem stems from. It doesn't happen all the time, but it may have to do with that character in the middle of an idle animation, but I'm not so sure.
-----------
And while I'm here, I think that Proskritos templates should not just be for download to anyone, but to only users of 2.62, or whatever the last version they were compiled with, since with the newer ags updates, there are conversion problems.

Until I, or others can make a template for the newest versions of ags, I would suggest to everyone to not upgrade their ags, and use an older version.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Lazarus

I've seem to have found away around my problem, in that by using ">td" (talk don't go) at the end of the characters name in the main character profile.
eg... guybrush>td

and then if I want to talk to the character I manually put move player command to the character in question before talking to them and so far it works every time with no problems.

I think the problem is with "always goto hotspot" and "clickable chacters" in the global script, but I could be wrong tho.

but by using the >td command the problem goes, and using the ">td" doesn't show up in the game if this is any help
*Currently using AGS Editor 2.70 (Build 2.70.601)*

Scummbuddy

Thanks for fiddling with it, and finding a possible solution. I will also give it a try and let you know. I appreciate the work you did.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Rincewind01

ok can anyone give me a link for a lucasarts monkey island 2 GUI that actually works as most links around here are 404. Also can i have a link fora tutorial or read me on installing the thing.

Scummbuddy

http://www.freewebs.com/skimbleshanks/templatesandmodules.htm

Just unzip the file, and place it all in your ags directory. When you create a new game, the new template choice should appear.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Rincewind01

hmmm
when i go to the GUI bit then click import the extension on the end of the mi2 is .agt and not .gui

Ashen

That's because it's a game template, not a GUI. You'll have to start a new game using that template (as Scummy just said) to get at the GUI - you can always export it from there if you want to use it in a game you've already started, but keep in mind there's probably some related scripting you'll need to copy over as well.
I know what you're thinking ... Don't think that.

Rincewind01

o my, the MI2 gui is in german, i would like an english one if its possible

Scummbuddy

- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Mats Berglinn

I'm trying to make some doors like in Secret of Monkey Island and Day of the Tentacle by using a hotspot area for the open door and a object for the closed one. The problem is that if you use the Any click commando it will affect the other commands, like if you try to use close the door Hotspot then it doesn't only close the door but it will transport to other room as well. That's not suppoused to happen. I'll show an example of that:

Code: ags
  // script for hotspot1: Any click on hotspot
NewRoomEx(4,74, 115);  

if (UsedMode(CLOSE)){ 
   if (GetPlayerCharacter() == BERN){
     MoveCharacterToObject(BERN,1);
     }
   if (GetPlayerCharacter() == LAVE){
     MoveCharacterToObject(LAVE,1);
     }
   if (GetPlayerCharacter() == HOAG){
     MoveCharacterToObject(HOAG,1);
     }
PlaySound(30);
ObjectOn(1);  
DisableHotspot(1);
}
if (UsedMode(OPEN)) Display("It's already open.");  


Does somebody know what's wrong and how to deal with it?

Ashen

You need to limit the NewRoom commands to running when a mode other OPEN or CLOSE is used. Try:
Code: ags

if (UsedMode(CLOSE)){
   if (GetPlayerCharacter() == BERN){
     MoveCharacterToObject(BERN,1);
     }
   if (GetPlayerCharacter() == LAVE){
     MoveCharacterToObject(LAVE,1);
     }
   if (GetPlayerCharacter() == HOAG){
     MoveCharacterToObject(HOAG,1);
     }
  PlaySound(30);
  ObjectOn(1); 
  DisableHotspot(1);
}

else if (UsedMode(OPEN)) Display("It's already open.");  

else NewRoomEx(4,74, 115); 


Also, couldn't you condense the 'CLOSE' condition to:
Code: ags

if (UsedMode(CLOSE)){
  MoveCharacterToObject(GetPlayerCharacter(),1);
  PlaySound(30);
  ObjectOn(1); 
  DisableHotspot(1);
}

instead of those if.. statements, since it does the same whichever character you're using.
I know what you're thinking ... Don't think that.

peluchin

Hello! I'd like to know if it is possible to change the distance between the objects you have picked up, when they appear in the menu, so i can make bigger icons that don't overlap. thanks!

monkey0506

Quote from: peluchin on Thu 28/07/2005 20:15:06
Hello! I'd like to know if it is possible to change the distance between the objects you have picked up, when they appear in the menu, so i can make bigger icons that don't overlap. thanks!

I think if you search the manual for SetInvDimensions you will find what you are looking for.  I don't know the parameters because I don't have a 2.62 manual available ATM.

Mats Berglinn

#277
I've some big problems here! Since my game have backgrounds that covers the whole screen unlike the old Lucas Arts games I had set the GUI so there are no black space. Since the Inventory window gets in the way for most walkable areas I had to get rid of the Inventory window from the Main GUI and instead make it into a new GUI. Now there's a strange problem: I have placed a new button in the Main GUI which activates the Inventory GUI (that's working). Now in the Inventory GUI there are three buttons: Arrow Up, Arrow Down and Close Down Inventory window. When I try to press the Close Down button nothing happens even if I scripted it to do so and when I open the Options GUI and then tries to Play, Load, Save or Quit, none of the functions works!

I've tried to check the script and doing changes but it keeps getting on like this. I don't understand what's wrong!!

Can you guys see what's wrong and can you tell me how it can be fixed? Please help me, I'm so desperate that I don't know what I'm going to do and it drives me crazy!Ã,  :'(

I'll show the whole script:

Code: ags
 
Ã,  }
//-----------------------------------------------------

//	change the arrows in the inventory to 
//	show if you can scroll the inventory:
//-----------------------------------------------------
Ã,  if (game.top_inv_item > 0){Ã,  Ã,  Ã, //if invent. can scroll up 
Ã,  Ã,  SetButtonPic(INVENTORY,0,1,INV_UP_ARROW_ON_SPRITE);
Ã,  Ã,  if (GetInvAt(FIRST_INV_SLOT_COORDS) < 0)//if no items shown in the inventory
Ã,  Ã,  Ã,  Ã, game.top_inv_item = game.top_inv_item - (game.num_inv_displayed/2 ); //scroll inventory up 
Ã,  }
Ã,  else //if can not scroll up
Ã,  Ã,  SetButtonPic(INVENTORY,0,1,INV_UP_ARROW_OFF_SPRITE);Ã,  Ã, 
Ã,  if (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)Ã,  Ã, //if invent. can scroll down 
Ã,  Ã,  SetButtonPic(INVENTORY,1,1,INV_DOWN_ARROW_ON_SPRITE);Ã,  
Ã,  elseÃ,  // if can not scroll down
Ã,  Ã,  SetButtonPic(INVENTORY,1,1,INV_DOWN_ARROW_OFF_SPRITE);
//-----------------------------------------------------
}
#sectionend repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) {////////////////////////////////////On Mouse Click///////////////On Mouse Click
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  
// Store type, name and id# of what the player clicked 
// on in global variables GSloctype,GSlocname & GSlocid:
//-----------------------------------------------------
 int mrx=mouse.x+GetViewportX(), mry=mouse.y+GetViewportY();
 GSloctype=GetLocationType(mouse.x,mouse.y);
 if (GSloctype==1) GSlocid=GetHotspotAt(mouse.x,mouse.y);
 else if (GSloctype==2) GSlocid=GetCharacterAt(mouse.x,mouse.y);
 else if (GSloctype==3) GSlocid=GetObjectAt(mouse.x,mouse.y);
 else if (GetInvAt(mouse.x, mouse.y)>=0) GSlocid=GetInvAt(mouse.x, mouse.y);
 GetLocationName(mouse.x,mouse.y,GSlocname);
//-----------------------------------------------------

 if (IsGamePaused() == 1) {
Ã,  Ã,  // Game is paused, so do nothing (ie. don't allow mouse click)
Ã,  }

//	Handling clicks in map rooms:
//-----------------------------------------------------
Ã,  else if (IsGUIOn(MAPS)==1){// if map
Ã,  Ã,  if (button==LEFT){
Ã,  Ã,  Ã,  if (IsInteractionAvailable(mouse.x,mouse.y,MODE_USE)) ProcessClick(mouse.x,mouse.y,MODE_USE);
Ã,  Ã,  Ã,  else ProcessClick(mouse.x,mouse.y,MODE_WALK);
Ã,  Ã,  }
Ã,  }//end if map
//-----------------------------------------------------

//	Handling room clicks:
//-----------------------------------------------------
Ã,  else if (button==LEFT || button==RIGHT) {
Ã,  Ã,  
Ã,  Ã,  if (button==RIGHT) SetMode(GetDefaultAction(mouse.x,mouse.y));// set the default mode when right click
Ã,  Ã,  
Ã,  Ã,  if (Extension(GSlocname)==EXITS_EXTENSION){// if its an 'exit'
Ã,  Ã,  Ã,  Ã,  HighlightActionBar();
Ã,  Ã,  Ã,  Ã,  WalkOffScreen(); 
Ã,  Ã,  }
Ã,  Ã,  else if (ALWAYS_GO_TO_HOTSPOTS==1 && ExtensionEx(2,GSlocname)!='d' && GetLocationType(mouse.x,mouse.y)!=0 ){
Ã,  Ã,  Ã,  Ã, UpdateActionBar(mrx,mry);
Ã,  Ã,  Ã,  Ã, HighlightActionBar();
Ã,  Ã,  Ã,  Ã, if (Go()==1)Ã,  Ã, ProcessAction(GSmode,mrx,mry);
Ã,  Ã,  Ã,  Ã, return;
Ã,  Ã,  }
Ã,  Ã,  else ProcessAction(GSmode,mrx,mry);
Ã,  }
//-----------------------------------------------------

//	Handling inventory clicks:
//-----------------------------------------------------
Ã,  else if (button == LEFTINV || button==RIGHTINV){//click in inventory
Ã,  Ã,  if (button == LEFTINV){
Ã,  Ã,  Ã,  if (GlobalCondition(1)) SetMode(SPECIAL_INV_MODE); //if walk or pickup mode in inventory
Ã,  Ã,  }
Ã,  Ã,  else if (button == RIGHTINV){
Ã,  Ã,  Ã,  SetMode(GetDefaultAction(mouse.x,mouse.y));
Ã,  Ã,  } 
Ã,  Ã,  ProcessInventoryAction(GSmode,GSlocid);Ã,  
Ã,  }
//-----------------------------------------------------

}
#sectionend on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart on_key_pressÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {///////////////////////////////////////On Key Press/////////////////On Key Press
Ã,  // called when a key is pressed. keycode holds the key's ASCII code

//	Pause/unpause with space bar:
//-----------------------------------------------------
Ã,  if (keycode==32){// SPACEBAR
Ã,  Ã,  if (IsGamePaused()==0){
Ã,  Ã,  Ã,  Ã, GUIOn(PAUSED);
Ã,  Ã,  Ã,  Ã, DisableInterface();
Ã,  Ã,  }
Ã,  Ã,  else{
Ã,  Ã,  Ã,  Ã, GUIOff(PAUSED);
Ã,  Ã,  Ã,  Ã, EnableInterface();
Ã,  Ã,  }
Ã,  }
//-----------------------------------------------------

//	Confirm exit with 'Y' and 'N' keys:
//-----------------------------------------------------
Ã,  if (IsGUIOn(CONFIRMEXIT)==1){ // if exit gui is on 
Ã,  Ã,  Ã, if (keycode == CONFIRM_GUIS_CHARACTER_NO) GUIOff(CONFIRMEXIT);//if N is pressed continue
Ã,  Ã,  Ã, if (keycode == CONFIRM_GUIS_CHARACTER_YES) QuitGame(0);//if Y is pressed quit game
Ã,  }
//-----------------------------------------------------

//	Confirm restart with 'Y' and 'N' keys:
//-----------------------------------------------------
Ã,  if (IsGUIOn(RESTART)==1){ // if exit gui is on 
Ã,  Ã,  Ã, if (keycode == CONFIRM_GUIS_CHARACTER_NO) GUIOff(RESTART);//if N is pressed continue
Ã,  Ã,  Ã, if (keycode == CONFIRM_GUIS_CHARACTER_YES) RestartGame();//if Y is pressed quit game
Ã,  }
//-----------------------------------------------------

Ã,  if (IsGamePaused() == 1) keycode=0;Ã,  // game paused, so don't react to keypresses
Ã,  
Ã,  if (keycode==359) Display("Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2004 Chris Jones[[SCUMM template by Proskrito :)");// F1
Ã,  if (keycode==363) GUIOn(OPTIONS);Ã,  Ã, // F5 - OPTIONS
Ã,  if (keycode==366) GUIOn(RESTART);Ã,  // F8 - RESTART 
Ã,  if (keycode==434) SaveScreenShot("scrnshot.bmp");Ã,  // F12
Ã,  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

//	Setting cursor modes using keys:
//-----------------------------------------------------
Ã,  if (Translation("default")){// if no translation file is being used
Ã,  Ã,  if (keycode == 'G')Ã,  SetMode(GIVE);		//G
Ã,  Ã,  if (keycode == 'P')Ã,  SetMode(PICKUP);Ã,  	//P
Ã,  Ã,  if (keycode == 'U')Ã,  SetMode(USE);Ã,  Ã,  Ã,  	//U
Ã,  Ã,  if (keycode == 'O')Ã,  SetMode(OPEN);Ã,  Ã,  Ã, 	//O
Ã,  Ã,  if (keycode == 'T')Ã,  SetMode(TALK);Ã,  	//T
Ã,  Ã,  if (keycode == 'S')Ã,  SetMode(PUSH);Ã,  Ã,  Ã, 	//S
Ã,  Ã,  if (keycode == 'C')Ã,  SetMode(CLOSE);Ã,  Ã,  	//C
Ã,  Ã,  if (keycode == 'L')Ã,  SetMode(LOOK);Ã,  	//L
Ã,  Ã,  if (keycode == 'Y')Ã,  SetMode(PULL);Ã,  Ã,  Ã, 	//Y
Ã,  }
//-----------------------------------------------------
}
#sectionend on_key_pressÃ,  // DO NOT EDIT OR REMOVE THIS LINE

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

Ã,  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);
Ã,  Ã,  
//-----------------------------------------------------
Ã,  Ã,  if (interface == MAINGUI) {
Ã,  Ã,  if (button == 9)Ã,  GUIOn(INVENTORY);
Ã,  Ã,  }
//-----------------------------------------------------Ã,  Ã,  

//	Options GUI
//-----------------------------------------------------
 if (interface == OPTIONS) {
Ã,  Ã,  if (button == 0){ //save game
Ã,  Ã,  Ã,  GUIOff(OPTIONS);
Ã,  Ã,  Ã,  GetLucasSavegameListBox(SAVE,1); // fills listbox 1 on gui SAVE with saved games
Ã,  Ã,  Ã,  GUIOn(SAVE);
Ã,  Ã,  Ã,  }
Ã,  Ã,  if (button == 1){ //load game
Ã,  Ã,  Ã,  GUIOff(OPTIONS);
Ã,  Ã,  Ã,  GetLucasSavegameListBox(RESTORE,1);
Ã,  Ã,  Ã,  GUIOn(RESTORE);
Ã,  Ã,  Ã,  }
Ã,  Ã,  if (button == 2){ // continue playing
Ã,  Ã,  Ã,  GUIOff(OPTIONS);
Ã,  Ã,  Ã,  }
Ã,  Ã,  if (button == 3){ // exit??
Ã,  Ã,  Ã,  GUIOn(CONFIRMEXIT);
Ã,  Ã,  Ã,  }
Ã,  Ã,  }
//-----------------------------------------------------

//	Restore game GUI
//-----------------------------------------------------
 if (interface == RESTORE) {
Ã,  Ã,  if (button ==2) GUIOff(RESTORE); //cancel
Ã,  Ã,  if (button ==1){ //click on listbox item
Ã,  Ã,  Ã,  Ã, int index = ListBoxGetSelected(RESTORE,1);
Ã,  Ã,  Ã,  Ã, if (GetSaveSlotDescription(index+100,buffer)==1){ //if there is a savegame here
Ã,  Ã,  Ã,  Ã,  Ã, GUIOff(RESTORE);
Ã,  Ã,  Ã,  Ã,  Ã, RestoreGameSlot(index+100); 
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã, }Ã,  Ã,  Ã, 
Ã,  Ã,  if (button == 3){ //scroll up
Ã,  Ã,  Ã,  Ã,  Ã, if (GStopsaveitem<5) GStopsaveitem=0;
Ã,  Ã,  Ã,  Ã,  Ã, else GStopsaveitem-=5;
Ã,  Ã,  Ã,  ListBoxSetTopItem(RESTORE,1,GStopsaveitem);
Ã,  Ã,  Ã,  }
Ã,  Ã,  if (button == 4 && GStopsaveitem<90) //scroll down
Ã,  Ã,  Ã,  GStopsaveitem+=5;
Ã,  Ã,  Ã,  ListBoxSetTopItem(RESTORE,1,GStopsaveitem);
Ã,  Ã,  }
//-----------------------------------------------------

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

 if (interface == SAVE){
Ã,  Ã,  int index=ListBoxGetSelected(SAVE,1);
Ã,  Ã,  if (button == 3){//cancel
Ã,  Ã,  Ã,  GUIOff(SAVE);
Ã,  Ã,  Ã,  GUIOff(SAVETEXTBOX);
Ã,  Ã,  }
Ã,  Ã,  if (button == 1){ //click on listbox
Ã,  Ã,  Ã, int stbypos;
Ã,  Ã,  Ã,  StrFormat(buffer,"%d.",index+1);
Ã,  Ã,  Ã,  SetLabelText(SAVETEXTBOX,1,buffer);
Ã,  Ã,  Ã,  if (GetSaveSlotDescription(index+100,buffer)==0) StrCopy(buffer,"");//GetSaveSlotDescription(index+100,buffer);
Ã,  Ã,  Ã,  //else StrCopy(buffer,"");
Ã,  Ã,  Ã, SetTextBoxText(SAVETEXTBOX,0,buffer);
Ã,  Ã,  Ã, stbypos=28+((index-GStopsaveitem)*(DEFAULT_FONT_HEIGHT+2)); //28 is set by trial-error. Deppends of the savegames listbox position
Ã,  Ã,  Ã, if (index<9)Ã,  SetGUIObjectPosition(SAVETEXTBOX, 0, 12, 0);
Ã,  Ã,  Ã, else SetGUIObjectPosition(SAVETEXTBOX, 0, 18, 0);Ã,  Ã,  Ã, 
Ã,  Ã,  Ã, SetGUIPosition(SAVETEXTBOX,29,stbypos);// 29 is set by trial-error. Same as above.
Ã,  Ã,  Ã, GUIOn(SAVETEXTBOX);
Ã,  Ã,  }
Ã,  Ã,  if (button == 2 && index>=0) { //save
Ã,  Ã,  Ã,  GetTextBoxText(SAVETEXTBOX,0,buffer);
Ã,  Ã,  Ã,  GUIOff(SAVE);
Ã,  Ã,  Ã,  GUIOff(SAVETEXTBOX);
Ã,  Ã,  Ã,  SaveGameSlot(index+100,buffer);
Ã,  Ã,  } 
Ã,  Ã,  if (button == 4){// scroll up
Ã,  Ã,  Ã,  Ã, GUIOff(SAVETEXTBOX);
Ã,  Ã,  Ã,  Ã, ListBoxSetSelected(SAVE,1,-1);
Ã,  Ã,  Ã,  Ã,  Ã, if (GStopsaveitem<5) GStopsaveitem=0;
Ã,  Ã,  Ã,  Ã,  Ã, else GStopsaveitem-=5;
Ã,  Ã,  Ã,  Ã, ListBoxSetTopItem(SAVE,1,GStopsaveitem);
Ã,  Ã,  }
Ã,  Ã,  if (button == 5 && GStopsaveitem<90){ //scroll down
Ã,  Ã,  Ã,  Ã, GUIOff(SAVETEXTBOX);
Ã,  Ã,  Ã,  Ã, ListBoxSetSelected(SAVE,1,-1);
Ã,  Ã,  Ã,  Ã, GStopsaveitem+=5;
Ã,  Ã,  Ã,  Ã, ListBoxSetTopItem(SAVE,1,GStopsaveitem);
Ã,  Ã,  }
Ã,  }
 if (interface == SAVETEXTBOX){
Ã,  Ã,  int index=ListBoxGetSelected(SAVE,1);
Ã,  Ã,  if (button == 0){
Ã,  Ã,  Ã,  GetTextBoxText(SAVETEXTBOX,0,buffer);
Ã,  Ã,  Ã,  GUIOff(SAVE);
Ã,  Ã,  Ã,  GUIOff(SAVETEXTBOX);
Ã,  Ã,  Ã,  SaveGameSlot(index+100,buffer);
Ã,  Ã,  }
Ã,  Ã,  if (IsButtonDown(RIGHT)) GUIOff(SAVETEXTBOX);Ã,  
 }
//-----------------------------------------------------

//	Scrolling the inventory:
//-----------------------------------------------------
Ã,  Ã,  if (interface == INVENTORY){

Ã,  Ã,  if ((button == 0) && (game.top_inv_item < game.num_inv_items - game.num_inv_displayed))
Ã,  Ã,  Ã,  game.top_inv_item = game.top_inv_item + (game.num_inv_displayed/2);
Ã,  Ã,  if ((button == 1) && (game.top_inv_item > 0))
Ã,  Ã,  Ã,  game.top_inv_item = game.top_inv_item - (game.num_inv_displayed/2);
Ã,  Ã,  Ã, }
Ã,  Ã,  Ã, } 
//-----------------------------------------------------

//Ã,  Ã,  Ã,  Close down the inventory:
//-----------------------------------------------------
Ã,  Ã,  if (interface == INVENTORY){
Ã,  Ã,  if (button ==2){
Ã,  Ã,  Ã, GUIOff(INVENTORY);
Ã,  Ã,  Ã, }
Ã,  Ã,  Ã, }
}


Ashen

For some reason you've got two if (interface == MAINGUI) conditions, and two for if (interface == INVENTORY). The INVENTORY ones aren't so important - there don't seem to be any conflicts, it just looks odd. However, one of the MAINGUI's isn't closed properly so everything down to the second INVENTORY condition ('Close down the Inventory') probably won't run (Ctrl-B to check braces, to see what I mean).

Try changing (I've added some comments):
Code: ags

  if (interface == MAINGUI) { // NOTE: MAINGUI opened

// 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);
   
//-----------------------------------------------------
    if (interface == MAINGUI) { // NOTE: MAINGUI opened again, for some reason
      if (button == 9)  GUIOn(INVENTORY);
    } // NOTE: Second MAINGUI closed
//-----------------------------------------------------   

// Options GUI
//-----------------------------------------------------
if (interface == OPTIONS) { // NOTE: First MAINGUI _still open_


to:

Code: ags

  if (interface == MAINGUI) { // NOTE: MAINGUI opened
// 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); 
//-----------------------------------------------------
    if (button == 9)  GUIOn(INVENTORY);
  } // NOTE: MAINGUI closed
//-----------------------------------------------------   

// Options GUI
//-----------------------------------------------------
if (interface == OPTIONS) {


I can't see why you can't turn the INVENTORY GUI off, though - unless there's another problem with the braces somewhere. It's probably worth giving them a thorough checking - when in doubt, always check your braces.
I know what you're thinking ... Don't think that.

Mats Berglinn

Thanks. The problems have been solved. I've discovered for the closing of inventory wasn't working. It was that I set the button 2 for it but the real button actually was 3 (and the number 2 was the inventory window, not a button). Silly me!

SMF spam blocked by CleanTalk