I have a character portrait gui in the corner of my game screen
I have it set up so that if the player clicks on the portrait of the player character then it will display a gui with the inventory in it
how would I go about making it disapear after a few mins if the player has not used the inventory?
When displaying the GUI, set a timer to seconds*GetGameSpeed()
In repeatedly_execute, check IsTimerExpired and if it is, turn off the GUI.
Also make sure that you reset the timer for whenever the player clicks on something in the inventory, otherwise it will close when the timer expires regardless of whether the player is using it.
Ok my needs on this changed what I need to do now is be able to take a character on the screen and click on them and bring up his inventory box as well as a couple other boxes with his avatar and a text box
I have no problem with this in the character control panel i simply set it up to anyclick on character will do all the above i needed
it works beautiful without any problem at all
Now im at the stage of where i need to do what I originally posted about and make the boxes disappear after a couple mins or so if nothing has happened down there.
instead of messing with timers and such is there a way that I could set it up easily that if you click on the player a second time it all disapears that would seem easier to me then the player has the control over when and how long the displays are available
Quote from: jamesreg on Wed 16/09/2009 15:19:40
Ok my needs on this changed what I need to do now is be able to take a character on the screen and click on them and bring up his inventory box as well as a couple other boxes with his avatar and a text box
I have no problem with this in the character control panel i simply set it up to anyclick on character will do all the above i needed
it works beautiful without any problem at all
NowI'm at the stage of where i need to do what I originally posted about and make the boxes disappear after a couple mins or so if nothing has happened down there.
instead of messing with timers and such is there a way that I could set it up easily that if you click on the player a second time it all disapears that would seem easier to me then the player has the control over when and how long the displays are available
You can do this:
Create two variables
bool = sthhappened;
int timer;
function on_mouse_click(something on the parenthesis, but can't recall it exactly) {
sthhappened=true;
}
function repeatedly_execute() {
if (sthhappened==true) timer=0;
if (sthhappened==false) {
timer++;
if (timer>= 6400) {//3 minutes
gGui1.Visible=false;//close the boxes here or whatever!
}
}
Thank you