<li><aclass="backlink"title="Click to do a full-text search for this title"href="./Guidelines_for_GUI_Editing_and_Creation?action=fullsearch&value=linkto%3A%22Guidelines+for+GUI+Editing+and+Creation%22&context=180">Guidelines for GUI Editing and Creation</a></li>
<spanclass="anchor"id="line-1"></span><ul><li>Use generalized animations to do basic, repeatable functions in your GUIs. For example, if you're using popups in your menu, create a single animation or named event that brings the generic popup graphics up, and then set a desktop float that will be checked in an if statement to determine which message to show on top of it. <spanclass="anchor"id="line-2"></span><spanclass="anchor"id="line-3"></span><spanclass="anchor"id="line-4"></span></li><liclass="gap"><pclass="line862">Organize your GUIs and use the parent-child relationship of nested <ahref="./Def_Types.html">windowDefs</a> to keep things organized. For example, if you have several animation <ahref="./Def_Types.html">windowDefs</a>, house them all under a parent windowDef marked "p_anims" or something similar. <spanclass="anchor"id="line-5"></span><spanclass="anchor"id="line-6"></span><spanclass="anchor"id="line-7"></span></li><liclass="gap"><pclass="line862">If you plan to resize <ahref="./Def_Types.html">windowDefs</a> through transitions frequently, it's helpful to create an invisible <ahref="./Def_Types.html">windowDef</a> that is sized to the new size and then using this <ahref="./Def_Types.html">windowDef</a> in your transition command accordingly, where "window1_newsize" is the invisible <ahref="./Def_Types.html">windowDef</a>: <spanclass="anchor"id="line-8"></span></li></ul><pclass="line867"><spanclass="anchor"id="line-9"></span><pre> transition "window1::rect" "$window1::rect" "$window1_newsize::rect" "250" ;
<spanclass="anchor"id="line-10"></span></pre><spanclass="anchor"id="line-11"></span><ul><li><pclass="line862">If your menus get large, it's helpful to create a few reset animations or named events that sets everything in a particular group of <ahref="./Def_Types.html">windowDefs</a> back to a default value. For example, you may want to reset a screen of buttons back to an unhighlighted default state. <spanclass="anchor"id="line-12"></span><spanclass="anchor"id="line-13"></span><spanclass="anchor"id="line-14"></span></li><liclass="gap"><pclass="line862">Use <ahref="./Scripting_Actions_and_Animations.html#animations">animations</a> when you know you need something to happen over time steps. Use <aclass="nonexistent"href="./Floats%252C_Definevec4%252C_and_NamedEvents.html#namedevent">named events</a> when you just want to set properties instantly. <spanclass="anchor"id="line-15"></span><spanclass="anchor"id="line-16"></span><spanclass="anchor"id="line-17"></span></li><liclass="gap">Statements in a script in the GUI system are executed simultaneously. If you want certain steps to happen before others, you must use an animation. <spanclass="anchor"id="line-18"></span><spanclass="anchor"id="line-19"></span><spanclass="anchor"id="line-20"></span></li><liclass="gap">Avoid calling named events or using the set "cmd" or consoleCmd statements in animations. If a frame gets dropped and your command or named event call is in that frame, it won't be executed and will break the GUI. <spanclass="anchor"id="line-21"></span><spanclass="anchor"id="line-22"></span><spanclass="anchor"id="line-23"></span></li><liclass="gap"><pclass="line862">If your <ahref="./GUIEditor.html">GUIEditor</a> crashes when you try to load a GUI, it's probably because of an error in your scripting. The most common culprits are brace errors or bad if statements. Since the <ahref="./GUIEditor.html">GUIEditor</a> lacks an error feedback system, it's best to save different versions of your gui files in case one becomes corrupted. Try to remember which area you were working in and if possible use an advanced editor such as Ultra Edit so that you can compare files against each other to spot differences that might have caused the crash/corruption. <spanclass="anchor"id="line-24"></span><spanclass="anchor"id="line-25"></span><spanclass="anchor"id="line-26"></span></li><liclass="gap"><pclass="line862">It's possible to use math statements in your Desktop header and element properties to achieve certain effects, such as dynamic placement. For examples of this, look at <strong>scoreboard.gui</strong> and <strong>mpmain.gui</strong>. But be careful! The <ahref="./GUIEditor.html">GUIEditor</a> has been known to corrupt Desktop headers with math statements in them if you open the Desktop scripting window in the editor. Saving a copy of your Desktop header to copy and paste in if this happens is usually helpful. <spanclass="anchor"id="line-27"></span><spanclass="anchor"id="line-28"></span></li></ul><pclass="line874">Example, A desktop header script such as this: <spanclass="anchor"id="line-29"></span><spanclass="anchor"id="line-30"></span><pre>windowDef Desktop
<spanclass="anchor"id="line-38"></span></pre><spanclass="anchor"id="line-39"></span><spanclass="anchor"id="line-40"></span><spanclass="anchor"id="line-41"></span><pclass="line862">Will turn into this: (<em>note the quotes that were stripped, this will break these script arguments</em>) <spanclass="anchor"id="line-42"></span><spanclass="anchor"id="line-43"></span><pre>windowDef Desktop
<spanclass="anchor"id="line-44"></span>{
<spanclass="anchor"id="line-45"></span> rect 0,0,640,480
<spanclass="anchor"id="line-51"></span></pre><spanclass="anchor"id="line-52"></span><ul><li><pclass="line862">The Desktop is a <ahref="./Def_Types.html">windowDef</a> just like all the others, and its properties can be modified as such. For instance, if you want to bring up a semi-transparent overlay, give the Desktop of your GUI a backcolor of 0,0,0,0.5. <spanclass="anchor"id="line-53"></span><spanclass="anchor"id="line-54"></span><spanclass="anchor"id="line-55"></span></li><liclass="gap"><pclass="line862">All elements in an GUI must have a unique name. When duplicating elements or creating new ones, the <ahref="./GUIEditor.html">GUIEditor</a> will sometimes give them unique names, but sometimes will not. If your elements don't have unique names the functionality of your GUI will likely be broken. If you save and close a gui that has multiple windows with the same name, it is possible to hand-edit the gui to fix this. However, if you instead save and close the <ahref="./GUIEditor.html">GUIEditor</a>, your work can be lost. <spanclass="anchor"id="line-56"></span><spanclass="anchor"id="line-57"></span><spanclass="anchor"id="line-58"></span></li><liclass="gap">GUI variables must be explicitly sent to each GUI that references them. If your GUI variable isn't working, try checking the code to be sure it's sending it to the right GUI. <spanclass="anchor"id="line-59"></span></li></ul><spanclass="anchor"id="bottom"></span></div><pid="pageinfo"class="info"lang="en"dir="ltr">Guidelines for GUI Editing and Creation (last edited 2005-11-04 23:00:40 by <spantitle="MattVainio @ 67.129.250.254[67.129.250.254]"><aclass="nonexistent"href="./MattVainio.html"title="MattVainio @ 67.129.250.254[67.129.250.254]">MattVainio</a></span>)</p>
<li><ahref="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a></li><li><ahref="http://www.python.org/">Python Powered</a></li><li><ahref="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a></li>