I did a search but came up with nothing specific. If there is a thread or tutorial on this already, slap me in the face and post me the URL with deserved scorn, please. :)
So I have my own inventory GUI(1) which is all working and lovely. And I want to player to be shown any new ovject flashing on and off in this GUI.
So I have a script:
GUIOn(1);
UpdateInventory();
AddInventory(3);
Wait(10);
LoseInventory(3);
Wait(10);
---repeated---
GUIOff(1);
I read in the manuals that the GUI doesn't get updated until the script has run its course, so I've included the UpdateInventory(); command. I even tried it after every AddInventory and LoseInventory command, but guess what: nothing.
The game waits because of all the Wait(x); commands but the inventory window does not show.
This is both for objects placed in the room as hotspots (for really small objects - don't want to make this into a pixelhunting game). But to no avail.
Any ideas on what I am doing wrong (other than trying to write scripts without being a programmer) ?
Hello James Kay,
Hmm, you add another inventory item, right? But what if you have one already? Add(Lose)Inventory() function actually adds(takes away) one certain item altering thier amount. So, if the player has 1 item#3 then the AddInvnetory() adds another one - so it has 2 now. And Lose Inventory substracts and you have 1 again and thereby the player doesn't lose the item.
Try that:
GUIOn(1);
---- repeatedly in while() -----
LoseInventory(3);
UpdateInventory();
Wait(10);
AddInventory(3);
UpdateInventory();
Wait(10);
------------------------------------
GUIOff(1);
EDIT: btw, both LoseInventory() and AddInventory update the inv window by themselves, therefore you don't even need to call UpdateInventory() one. ;)
~Cheers
Nope, that's not it. I don't use the "AddInventory" scriptline until after I open the GUI. But just in case I tried adding an extra LoseInventory line. To no avail. The GUI still doesn't show up at all. :'(
But didn't you check start-with-this-inv-item option?
If it doesn't help put a display:
GUIOn(1);
---- repeatedly in while() -----
LoseInventory(3);
Display("item (3) amount: %d", character[GetPlayerCharacter()].inv[3]);
Wait(10);
AddInventory(3);
Display("item (3) amount: %d", character[GetPlayerCharacter()].inv[3]);
Wait(10);
------------------------------------
GUIOff(1);
it should display 0 then 1, again 0 etc... :P
"start-with-this-inv-item" is not ticked.
I added the code: it does indeed say 0 - 1 (I repeated it three times to be certain, and it does say 0 - 1 - 0 - 1 - 0 - 1, so that doesn't seem to be the problem.
:-[
I dont have the manual with me where I am, but what about changing the inv image with SetInvItemPic or something like that. (You could have it flash that way with like a faded pic of it, to a bright version of it.)
If anyone wants to jump in here and correct me.
Yeah, Scummbuddy is right - this should work better because I've just checked and found out that AddInventory function makes an item to be the last one in the inv. window. :P and that might be the reason ;)
~Cheers
Ooh, that would be cool, to have an alterate image of the same object flash on and off.
But as it stands I can't even get the Inventory GUI to appear yet, let alone switch image (or switch them on or off). This is odd as I use the GUIOff and GUIOn messages effectively when writing "look at" scripts for inventory items (otherwise the text appears offset to the character for some reason).
do you have it set as a popup modal?
QuoteBut as it stands I can't even get the Inventory GUI to appear yet
this one makes me to re-read you original question and I have realized (just now :)) the problem in showing that GUI.
ok, so you have an object, then you pick it up and then a GUI is displayed and you want an inv item flashing in that inv window, yes? :P
Correctomundo.
I have a custom INVENTORY GUI, (1) as it happens, and it's a pop-up type. It works fine everywhere else in the game, though I had a problem with text alignment running the DisplaySpeech script for look-at-inventory actions, so I added a GUIOff(1); before and GUIOn(1); after the DisplaySpeech line and that solved the problem nicely.
But indeed, I want the player to click on an item or hotspot, bring up the INVENTORY GUI (not happening), flash the item on and off a few times (might be happening but as the GUI is not visible I can't confirm this), and switch off the GUI again (again, impossible because it doesn't show up in the first place).
are you using braces where appropriate? we'll need to see your code for the room
Yeah, the braces seem in place.
I don't have the game here (at work) but I'll post it this weekend. Cheers for the time, guys!
btw, what interaction did you use, interact (hotspot/object) or pick up? If it's the last then you need to enable the PickUp cursor mode as well.
as about the interact interaction :) it usually looks like:
// room script file
function hotspot...() {
// script for hotspot...: Interact hotspot
Display("hotspot interaction is being run!");
GUIOn(1);
}
function object...() {
// script for object...: Interact object
GUIOn(1);
}
Also try placing a display message (like I did for the hotspot) then you should see that message during the interaction. If you don't, it means the interaction isn't run at all for some reason.
Do you have the When interface Disabled set to GUIs turn off?
If'n I am thinking right, the wait command will disable the gui if that option is set the gui will turn off.
Very good point!
Quote from: Alynn on Fri 12/12/2003 15:05:33
Do you have the When interface Disabled set to GUIs turn off?
If'n I am thinking right, the wait command will disable the gui if that option is set the gui will turn off.
Eureka! That did the trick. Thanks!!!!!
BUT...now I have to find a way to switch off the GUI(0) icon bar during blocked events. Please tell me there is a simple trick for that!
Wellllllll... GUIOff(0).... you probably need to manually do that. and GUIOn(0) to turn them back on.
Ahhh....bugger.... so everytime I have a blocked event I need to GUIoff(0); ?
Solved one problem, but created a couple of dozen tiny headaches.
Thanks for all the help. This one I would never have figured out myself! :-[
Well if you dont mind the GUIs just graying out you can always set that option, unless you need that gui to disappear (IE you need to see the whole screen and what not....)
Personally my GUI's just gray out for the most part.
Having an option to set different behaviors for the different GUIs during the interface blocking would be a good idea. :P
Anyway if you use Wait() to flash an item the player will be unable to operate the inventory window untill the blinking is gone. Or is it the way that it's supposed to work?
I can write a script, so it will blink on the background. This way the player can navigate an inventory gui and (since I won't use the Wait() in that case) you could leave turning off for the GUIs during blocking enabled. :P
Ugh, the greying out is ugly. Not what I want. I'll have to GUIOff the mother every time I do some blocked event.
Maybe a feature suggestion: have a GUIOff setting for the GUIs, as in, when GUI is off, what do I show? Maybe a 2nd version of the GUI. Like the character views.
Character view: 1
Talking view: 2
Maybe you can have GUIon view: 1, GUIOff view: 2.
Just a thought.
As for the blinking, yeah, I just want to show the people that the item they just picked up is HERE, LOOK HERE, in your inventory it's THIS ITEM HERE. And then switch off the inventory window again and straight back into the game.
Testing the game without this blinking up until now really shows the need for this little communication. I think all adventure games should have this as a rule. Damn, it should be a AGS default setting or at the very least a tickbox in the General Settings! ;D
<v> Flash new items in the inventory window? < number of times >
If you don't like the gerying-out, try the "GUIs go black when disabled" game option (global option page of AGSEdit)