making gui visable then disapear after a few mins (SOLVED)

Started by jamesreg, Tue 15/09/2009 19:27:15

Previous topic - Next topic

jamesreg

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?

Khris

When displaying the GUI, set a timer to seconds*GetGameSpeed()
In repeatedly_execute, check IsTimerExpired and if it is, turn off the GUI.

Ethan D

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.

jamesreg

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

Dualnames

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!
}
}
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)


SMF spam blocked by CleanTalk