Can't get an item to select in custom Inventroy Screen

Started by Etcher Squared Games, Sat 14/08/2004 21:44:46

Previous topic - Next topic

Etcher Squared Games

(please note that I read all I could throughout the forums and found no help otherwise....)

I even found a website tutorial:
http://www.digitalmindstudio.ch/script.php?id=4&page=2

now while I did NOT do everything on this page. I thought I was doing enough...

basically, this is my first game, so I don't care about look, use or whatever....I just want to for now open an inventory window (i can do that)....have my pointer arrow be the only cursor available (i can do that) then you click on the item to select it (i CAN'T do that)  and then click ok....

if you click ok while the arrow is still up, I default you back to walk...

I saw on these boards that it HAS to be the interact cursor to select an item...  I tried that...no go....I click on my inventory and just nothing happens....


here is my global script thus far.....

// main global script file



function Cursors_gamehourglass()
{
  DisableCursorMode(0);
  DisableCursorMode(1);
  DisableCursorMode(2);
  DisableCursorMode(6);
  EnableCursorMode(7);
  SetCursorMode(7);
}

function Cursors_gamearrow()
{
  DisableCursorMode(0);
  DisableCursorMode(1);
  DisableCursorMode(2);
  DisableCursorMode(7);
  EnableCursorMode(6);
  SetCursorMode(6);
}




function Cursors_gamenormal()
{
  EnableCursorMode(0);
  EnableCursorMode(1);
  EnableCursorMode(2);
  EnableCursorMode(6);
  DisableCursorMode(7);
}


int Direction_to_outsidebank = -1;  // 0 = from bank, 1 = from east






#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() // called when the game starts, before the first room is loaded
  {
    SetInvDimensions(20, 20);
  }
#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
  Cursors_gamearrow();
  DisableCursorMode(6);
  EnableCursorMode(2);
  SetCursorMode(2);
  SetMouseCursor(6);
  GUIOff(1);
  GUIOn (2);   
  }

#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.pcx");  // 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)
    {
    Display("ddd"); 
    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)
  {
    if (interface == 1) // top side gui
    {
      if (button == 0) 
      {     
        //InventoryScreen();
        show_inventory_window();
        SetCursorMode(2);
      } 
    }
    else if (interface == 2)
    {
      if (button == 1)
      {
        GUIOff(2);
        GUIOn(1);
        Cursors_gamenormal();
        if (GetCursorMode() != 4)  // didn't select an item
          SetCursorMode(0);
      }
      else if (button == 2)
      {
        SetCursorMode(2);
        SetMouseCursor(6);
      }
      else
      {       
        string buffer;
        StrFormat (buffer, "%d", button);
        Display(buffer);
      } 
    }
  }
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE






export Direction_to_outsidebank;

#sectionstart inventory1_a  // DO NOT EDIT OR REMOVE THIS LINE
function inventory1_a() {
  // script for inventory1: Use inventory on this item
 
}
#sectionend inventory1_a  // DO NOT EDIT OR REMOVE THIS LINE




if there is any other information you guys need let me know and I'll post it....
website: http://www.etcher2games.com/
email: etcher2games@yahoo.com
forum: http://www.etcher2games.com/forums

Anyone want to make my website for free?

Etcher Squared Games

I've done well learning AGS on my own...so I felt really bad when this is one thing that stumped me.  I'm reply to myself so that future people can benefit from my question.

1.  I had somehow missed there was a LEFTINV and RIGHTINV mouse event constants that are different from LEFT and RIGHT.  that's why stuff was never activated in script

2.  Through various other threads and tutorials, I had "handle inventory clicks in script" checked.... in my case this was a bad thing...  What I don't understand yet, is why would someone want this.  Anyone please clarify...

3.  Another thing I missed that I have only found one deeply hidden line against, is you HAVE to select inventory items with the cursor #2 INTERACT.  I was trying to use the pointer cursor.  But to note, there is a setmousecursor function.
so, you must SetCursorMode(2) but then make it look like anything else with SetMouseCursor(#).

4.  another thing that killed me and when I fixed this up this is what I think actually cured my problem, but again, would like someone else to possibly explain
I had a bunch a stray Disable/EnabledCursorMode commands.
I did have #2 interact enabled, but I don't know why it wasn't taking.  I've even tried unchecking handle inv in script.

5. Another thing I did, every tutorial I found had in them "add a look button, add a use button, add a close button"
originally I just had a close button, but defaulted the window to the USE cursor



but now it's working and I've even successfully (in like 5 min once I got everything else working) had interactions between one object to another (and they combined as I wanted....)



so, as I said, if anyone can explain what's going on here, for me and others, that would be much appreciated.

thank you
website: http://www.etcher2games.com/
email: etcher2games@yahoo.com
forum: http://www.etcher2games.com/forums

Anyone want to make my website for free?

SilverWizard_OTF

2. I suppose that with checking this option, then when we click an item, it runs a script that we have created, not the default script routine for item click.

Well, maybe someone finds useful that. Maybe someone want to happen different things when he selects items from the inventory.
I suppose.
"All we have to decide is what to do, with the time that is given to us"

SMF spam blocked by CleanTalk