Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-07-2008, 10:55 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Which is more efficient?

I was reading the other thread about the news thing...
Anyways, which is more efficient, letting a GUI be closed(and destroyed) and recreating it whenever it's needed or having it hide on being closed, and simply showing it when needed?
I'm asking because I'm not sure how exactly GUI's are handled and if having one destroyed is quite the same as one that's not visible. So I guess this is a question for those a bit in the knowing about the behind-the-scenes stuff.
Reply With Quote
  #2  
Old 02-07-2008, 11:04 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Well, storing it won't take CPU, but memory.

Destroying it and then recreating it would take CPU but in spikes.
__________________
Reply With Quote
  #3  
Old 02-07-2008, 11:30 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I always use the destroy/recreate method when I'm working on it....then just forget to take it out
Reply With Quote
  #4  
Old 02-07-2008, 11:52 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
I'm not so sure, either. I normally just create them then change the visible flag. I believe the scripted RC does this also.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #5  
Old 02-08-2008, 12:10 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by napo_p2p View Post
I'm not so sure, either. I normally just create them then change the visible flag. I believe the scripted RC does this also.
The Scripted RC's main window with RC chat is created when you first start to use it, hidden when you use the X button or F6, rather than destroyed, and brought back as needed. All of the other windows are destroyed, and are recreated as necessary.
Reply With Quote
  #6  
Old 02-08-2008, 12:29 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
You can notice that all of the default built-in guis are never destroyed but are in fact hidden.
__________________
Do it with a DON!
Reply With Quote
  #7  
Old 02-08-2008, 01:07 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
It usually depends for me. If it's a Gui that can change a lot, I generally don't destroy it, so I won't have to use a lot of processing bringing it back. Otherwise I do destroy and recreate it.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #8  
Old 02-08-2008, 02:31 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
If you hide it and show it again later then the position and size are the same, which is often better than recreating it and the user needs to move it again if it's not at the good place. You can use showtop() to make the window appear on top, un-minimize and get the input focus.
Normally creating and hiding windows is not a big problem, they might take a few kbytes in memory but should not be a speed problem. There are many default windows (playerlist, F5, F2 etc.) which are created in invisible state when you login to the login server. For stuff like PM windows it needs to create new windows of course, and is then also destroying them when you close them.
So I would say if you only need the window one time then destroy it afterwards, and if you plan to open it several times then just hide and reopen it next time.
Reply With Quote
  #9  
Old 02-08-2008, 08:47 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Exactly. For something like an inventory or a player chat system, you should most likely just be hiding/showing it. Something that creates a separate GUI for each instance should just be created/destroyed.

I also sometimes go in the middle and show/hide a main gui but destroy its contents for GUIs that are ambiguous.
__________________
Do it with a DON!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.