Hi Steptoe,
I faced the same problem in my game, but I solved with a little workaround (since I think that it's better to leave the 'hard coded parts' alone until you PERFECTLY know what you are doing EXACTLY).
I've written a function that checks which inventory item is currently under the cursor, and I used it for a double-purpose:
1.To print the name of the inventory item in a label in the inventory window
2.To work around the hard coded 'interact with inventory'.
in GlobalScript.asc:
Code: ags
Then, since you have coded that behaviour that works perfectly with eModeLookat, you'll just add this
Code: ags
Then, in game repeatedly_execute, you just make a call to the function
Code: ags
Obviously you can use only the code that 'change' the mouse.Mode to give the player the illusion of 'interacting' with the item that will only open a new gui instead of change the mouse.Mode to eModeUseInv.
I hope I haven't forgot nothing and that this can be of help.
Let us know...
Cheers
I faced the same problem in my game, but I solved with a little workaround (since I think that it's better to leave the 'hard coded parts' alone until you PERFECTLY know what you are doing EXACTLY).
I've written a function that checks which inventory item is currently under the cursor, and I used it for a double-purpose:
1.To print the name of the inventory item in a label in the inventory window
2.To work around the hard coded 'interact with inventory'.
in GlobalScript.asc:
function Inventory_Label_and_FakeInteract()
{
if(gInventory.Visible==true)
{
//I create an Inventory item token named 'item' that store the displayed object
//at the actual mouse position
InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
//If the mouse is over that item I want to open the new gui (iNew_Gui) I change the mouse.Mode
//from eModeInteract to another custom mode "eModeFakeInteract" that has the
//same graphic that the interact cursor, viceversa I restore the 'true' eModeInteract
if(item==iNew_Gui && mouse.Mode==eModeInteract)
{mouse.Mode=eModeFakeInte;}
if(item!=iNew_Gui && mouse.Mode==eModeFakeInte)
{mouse.Mode=eModeInteract;}
//If mouse cursor isn't pointing an inventory item I 'empty' the label
if(item==null){lblInventory.Text="";}
//if mouse cursor is pointing an inventory item I print the inventory name
else{lblInventory.Text=item.Name;}
}
}
Then, since you have coded that behaviour that works perfectly with eModeLookat, you'll just add this
function iNew_Gui_OtherClick()
{
if(mouse.Mode==eModeFakeInte)
{iNew_Gui.RunInteraction(eModeLookat);}
}
Then, in game repeatedly_execute, you just make a call to the function
Inventory_Label_and_FakeInteract();
Obviously you can use only the code that 'change' the mouse.Mode to give the player the illusion of 'interacting' with the item that will only open a new gui instead of change the mouse.Mode to eModeUseInv.
I hope I haven't forgot nothing and that this can be of help.
Let us know...
Cheers