mirror of
https://github.com/dhewm/iddevnet.git
synced 2024-11-22 04:21:59 +00:00
5a7e5cbe45
it's more or less usable now! all images (except for the ones of moinmoin itself) are still missing. possibly articles are missing as well, haven't checked yet (and the lost downloads are missing, of course)
297 lines
20 KiB
HTML
297 lines
20 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||
<meta name="robots" content="index,nofollow">
|
||
|
||
<title>Floats, Definevec4, and NamedEvents - Quake 4 SDK Documentation</title>
|
||
<script type="text/javascript" src="wiki/common/js/common.js"></script>
|
||
|
||
<script type="text/javascript">
|
||
<!--// common functions
|
||
|
||
// We keep here the state of the search box
|
||
searchIsDisabled = false;
|
||
|
||
function searchChange(e) {
|
||
// Update search buttons status according to search box content.
|
||
// Ignore empty or whitespace search term.
|
||
var value = e.value.replace(/\s+/, '');
|
||
if (value == '' || searchIsDisabled) {
|
||
searchSetDisabled(true);
|
||
} else {
|
||
searchSetDisabled(false);
|
||
}
|
||
}
|
||
|
||
function searchSetDisabled(flag) {
|
||
// Enable or disable search
|
||
document.getElementById('fullsearch').disabled = flag;
|
||
document.getElementById('titlesearch').disabled = flag;
|
||
}
|
||
|
||
function searchFocus(e) {
|
||
// Update search input content on focus
|
||
if (e.value == 'Search') {
|
||
e.value = '';
|
||
e.className = '';
|
||
searchIsDisabled = false;
|
||
}
|
||
}
|
||
|
||
function searchBlur(e) {
|
||
// Update search input content on blur
|
||
if (e.value == '') {
|
||
e.value = 'Search';
|
||
e.className = 'disabled';
|
||
searchIsDisabled = true;
|
||
}
|
||
}
|
||
|
||
function actionsMenuInit(title) {
|
||
// Initialize action menu
|
||
for (i = 0; i < document.forms.length; i++) {
|
||
var form = document.forms[i];
|
||
if (form.className == 'actionsmenu') {
|
||
// Check if this form needs update
|
||
var div = form.getElementsByTagName('div')[0];
|
||
var label = div.getElementsByTagName('label')[0];
|
||
if (label) {
|
||
// This is the first time: remove label and do buton.
|
||
div.removeChild(label);
|
||
var dobutton = div.getElementsByTagName('input')[0];
|
||
div.removeChild(dobutton);
|
||
// and add menu title
|
||
var select = div.getElementsByTagName('select')[0];
|
||
var item = document.createElement('option');
|
||
item.appendChild(document.createTextNode(title));
|
||
item.value = 'show';
|
||
select.insertBefore(item, select.options[0]);
|
||
select.selectedIndex = 0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//-->
|
||
</script>
|
||
|
||
|
||
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="wiki/modern/css/common.css">
|
||
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="wiki/modern/css/screen.css">
|
||
<link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="wiki/modern/css/print.css">
|
||
<link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="wiki/modern/css/projection.css">
|
||
|
||
<!-- css only for MSIE browsers -->
|
||
<!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="wiki/modern/css/msie.css">
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<link rel="Start" href="./Quake4SDK.html">
|
||
<link rel="Alternate" title="Wiki Markup" href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=raw">
|
||
<link rel="Alternate" media="print" title="Print View" href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=print">
|
||
<link rel="Search" href="./FindPage.html">
|
||
<link rel="Index" href="./TitleIndex.html">
|
||
<link rel="Glossary" href="./WordIndex.html">
|
||
<link rel="Help" href="./HelpOnFormatting.html">
|
||
</head>
|
||
|
||
<body lang="en" dir="ltr">
|
||
|
||
<div id="header">
|
||
<div id="logo"><a href="./Quake4SDK.html"><img src="wiki/common/moinmoin.png" alt="MoinMoin Logo"></a></div>
|
||
|
||
<form id="searchform" method="get" action="">
|
||
<div>
|
||
<input type="hidden" name="action" value="fullsearch">
|
||
<input type="hidden" name="context" value="180">
|
||
<label for="searchinput">Search:</label>
|
||
<input id="searchinput" type="text" name="value" value="" size="20"
|
||
onfocus="searchFocus(this)" onblur="searchBlur(this)"
|
||
onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search">
|
||
<input id="titlesearch" name="titlesearch" type="submit"
|
||
value="Titles" alt="Search Titles">
|
||
<input id="fullsearch" name="fullsearch" type="submit"
|
||
value="Text" alt="Search Full Text">
|
||
</div>
|
||
</form>
|
||
<script type="text/javascript">
|
||
<!--// Initialize search form
|
||
var f = document.getElementById('searchform');
|
||
f.getElementsByTagName('label')[0].style.display = 'none';
|
||
var e = document.getElementById('searchinput');
|
||
searchChange(e);
|
||
searchBlur(e);
|
||
//-->
|
||
</script>
|
||
|
||
<ul id="username"><li><a href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=login" id="login">Login</a></li></ul>
|
||
<div id="locationline">
|
||
|
||
|
||
<ul id="pagelocation">
|
||
<li><a class="backlink" title="Click to do a full-text search for this title" href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=fullsearch&value=linkto%3A%22Floats%2C+Definevec4%2C+and+NamedEvents%22&context=180">Floats, Definevec4, and NamedEvents</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
|
||
|
||
<ul id="navibar">
|
||
<li class="wikilink"><a href="./GettingStarted.html">GettingStarted</a></li><li class="wikilink"><a href="./ScriptFile.html">ScriptFile</a></li><li class="wikilink"><a href="./MakeAMod.html">MakeAMod</a></li><li class="wikilink"><a href="./LevelEditor.html">LevelEditor</a></li><li class="wikilink"><a href="./FXEditor.html">FXEditor</a></li><li class="wikilink"><a href="./GUIEditor.html">GUIEditor</a></li><li class="wikilink"><a href="./Sounds.html">Sounds</a></li><li class="wikilink"><a href="./Animations.html">Animations</a></li><li class="wikilink"><a href="./ArtReference.html">ArtReference</a></li><li class="wikilink"><a href="./DownloadableContent.html">DownloadableContent</a></li><li class="wikilink"><a href="./RecentChanges.html">RecentChanges</a></li><li class="wikilink"><a href="./FindPage.html">FindPage</a></li><li class="wikilink"><a href="./HelpContents.html">HelpContents</a></li><li class="current"><a href="./Floats%2C_Definevec4%2C_and_NamedEvents.html">Floats, Def...NamedEvents</a></li>
|
||
</ul>
|
||
|
||
<div id="pageline"><hr style="display:none;"></div>
|
||
|
||
<ul class="editbar"><li><span class="disabled">Immutable Page</span></li><li><a href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=info">Info</a></li><li><a href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=AttachFile">Attachments</a></li><li>
|
||
<form class="actionsmenu" method="get" action="">
|
||
<div>
|
||
<label>More Actions:</label>
|
||
<select name="action"
|
||
onchange="if ((this.selectedIndex != 0) &&
|
||
(this.options[this.selectedIndex].disabled == false)) {
|
||
this.form.submit();
|
||
}
|
||
this.selectedIndex = 0;">
|
||
<option value="raw">Raw Text</option>
|
||
<option value="print">Print View</option>
|
||
<option value="RenderAsDocbook">Render as Docbook</option>
|
||
<option value="refresh">Delete Cache</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="SpellCheck">Check Spelling</option>
|
||
<option value="LikePages">Like Pages</option>
|
||
<option value="LocalSiteMap">Local Site Map</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="RenamePage" disabled class="disabled">Rename Page</option>
|
||
<option value="DeletePage" disabled class="disabled">Delete Page</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="MyPages">My Pages</option>
|
||
<option value="SubscribeUser">Subscribe User</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="Despam">Remove Spam</option>
|
||
<option value="PackagePages">Package Pages</option>
|
||
</select>
|
||
<input type="submit" value="Do">
|
||
</div>
|
||
<script type="text/javascript">
|
||
<!--// Init menu
|
||
actionsMenuInit('More Actions:');
|
||
//-->
|
||
</script>
|
||
</form>
|
||
</li></ul>
|
||
|
||
</div>
|
||
|
||
<div id="page" lang="en" dir="ltr">
|
||
<div dir="ltr" id="content" lang="en"><span class="anchor" id="top"></span>
|
||
<span class="anchor" id="line-1"></span><p class="line862">The Desktop can contain information and definitions that are referenced throughout the GUI (and also information that can be referenced outside of the GUI by the game code). <strong>Floats</strong> are values that are often used in if statements as checks. <strong>Definevec4</strong> defines a 4-component value (a color or a size value) and gives it a name that’s easier to reference throughout the GUI. <strong>namedEvent</strong> defines a set of actions to be performed when the namedEvent is referenced in a script or from the GUI itself. <span class="anchor" id="line-2"></span><span class="anchor" id="line-3"></span><p class="line862">Finally, the desktop will usually also contain two other scripts: <strong>onInit</strong> and <strong>onESC</strong>. Both of these define actions to happen when the GUI is loaded and when it is closed, respectively. <span class="anchor" id="line-4"></span><span class="anchor" id="line-5"></span><p class="line867">
|
||
<h3 id="head-c862ad59e39e94e213d61f9db16c520491ce4d70">Floats and Definevec4</h3>
|
||
<span class="anchor" id="line-6"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-7"></span>The syntax for these items are as follows: <span class="anchor" id="line-8"></span><span class="anchor" id="line-9"></span><ul><li style="list-style-type:none"><p class="line891"><strong>float “valuename” “0”</strong> <span class="anchor" id="line-10"></span><span class="anchor" id="line-11"></span></li></ul><p class="line874">This defines a variable named valuename and sets it to 0. <span class="anchor" id="line-12"></span><span class="anchor" id="line-13"></span><ul><li style="list-style-type:none"><p class="line891"><strong>definevec4 “yellowtext” “1,1,0,1”</strong> <span class="anchor" id="line-14"></span><span class="anchor" id="line-15"></span></li></ul><p class="line862">This defines a vec4 called “yellowtext” and sets its RGB + Alpha value to 1,1,0,1. This is extremely usefull when <a href="#definevec4">used in conjunction with transitions</a> as it allows transitions to reference colors specified as a float rather than hard coded values. If you have a bunch of places you want to transition a color and decide later that you want to change this color, you only have to adjust the desktop float rather than every single place in your onTime animation. <span class="anchor" id="line-16"></span><span class="anchor" id="line-17"></span><p class="line867"><span class="anchor" id="namedevent"></span> <span class="anchor" id="line-18"></span>
|
||
<h3 id="head-a478f4695ffee2ef94c8d8fa31111274ac574aee">namedEvent</h3>
|
||
<span class="anchor" id="line-19"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-20"></span>The syntax for this command is identical to all other scripting functions. namedEvents are usually defined after the floats and vec4s in the Desktop using the <strong>onNamedEvent</strong> function, but they can also be placed in any <a href="./Def_Types.html">windowDef</a> in the GUI. When the <strong>namedEvent</strong> command is used (either by the GUI itself or from code), it the statements in the corresponding <strong>onNamedEvent</strong> function are executed. <span class="anchor" id="line-21"></span><span class="anchor" id="line-22"></span><p class="line874">The following is a named event defined in the Desktop that sets a windowDef's backcolor: <span class="anchor" id="line-23"></span><span class="anchor" id="line-24"></span><p class="line867"><span class="anchor" id="line-25"></span><pre> onNamedEvent SetBackcolor
|
||
<span class="anchor" id="line-26"></span> {
|
||
<span class="anchor" id="line-27"></span> set "foo::backcolor" "1,0,0,1" ;
|
||
<span class="anchor" id="line-28"></span> }
|
||
<span class="anchor" id="line-29"></span></pre><span class="anchor" id="line-30"></span><span class="anchor" id="line-31"></span><p class="line862">The following example sends the command to execute that named event when the player selects the <a href="./Def_Types.html">windowDef</a>: <span class="anchor" id="line-32"></span><span class="anchor" id="line-33"></span><p class="line867"><span class="anchor" id="line-34"></span><pre> windowDef foo2
|
||
<span class="anchor" id="line-35"></span> {
|
||
<span class="anchor" id="line-36"></span> rect 0,0,300,300
|
||
<span class="anchor" id="line-37"></span> visible 1
|
||
<span class="anchor" id="line-38"></span>
|
||
<span class="anchor" id="line-39"></span> onAction
|
||
<span class="anchor" id="line-40"></span> {
|
||
<span class="anchor" id="line-41"></span> namedEvent "SetBackcolor" ;
|
||
<span class="anchor" id="line-42"></span> }
|
||
<span class="anchor" id="line-43"></span> }
|
||
<span class="anchor" id="line-44"></span></pre><span class="anchor" id="line-45"></span><span class="anchor" id="line-46"></span><p class="line862">The following example does the same thing, but references a named event that is defined in the <a href="./Def_Types.html">windowDef</a> named "foo3" and not in the Desktop: <span class="anchor" id="line-47"></span><span class="anchor" id="line-48"></span><p class="line867"><span class="anchor" id="line-49"></span><pre> windowDef foo2
|
||
<span class="anchor" id="line-50"></span> {
|
||
<span class="anchor" id="line-51"></span> rect 0,0,300,300
|
||
<span class="anchor" id="line-52"></span> visible 1
|
||
<span class="anchor" id="line-53"></span>
|
||
<span class="anchor" id="line-54"></span> onAction
|
||
<span class="anchor" id="line-55"></span> {
|
||
<span class="anchor" id="line-56"></span> namedEvent "foo3::SetBackcolor" ;
|
||
<span class="anchor" id="line-57"></span> }
|
||
<span class="anchor" id="line-58"></span> }
|
||
<span class="anchor" id="line-59"></span></pre><span class="anchor" id="line-60"></span><span class="anchor" id="line-61"></span><p class="line867">
|
||
<h3 id="head-8b6d815dfd0f17b95932699f8a2f3761a165df3f">An Example Desktop Script</h3>
|
||
<span class="anchor" id="line-62"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-63"></span><strong>Floats</strong>, <strong>vec4s</strong>, <strong>namedEvents</strong>, and <strong>onInit</strong> and <strong>onESC</strong> are defined in the Desktop just as other scripts are for other <a href="./Def_Types.html">windowDefs</a> – hit <strong>ctrl + Enter</strong> to bring up the scripting window and enter them in. The following would be an example Desktop script. Note that the values defined at the top of the Desktop do not end with a semicolon as all other scripting commands do. <span class="anchor" id="line-64"></span><span class="anchor" id="line-65"></span><p class="line867"><span class="anchor" id="line-66"></span><pre> definevec4 “yellowtext_on” “1,1,0,1”
|
||
<span class="anchor" id="line-67"></span> definevec4 “yellowtext_off” “1,1,0,0.5”
|
||
<span class="anchor" id="line-68"></span> float “check1” “0”
|
||
<span class="anchor" id="line-69"></span> float “check2” “0”
|
||
<span class="anchor" id="line-70"></span>
|
||
<span class="anchor" id="line-71"></span> onInit
|
||
<span class="anchor" id="line-72"></span> {
|
||
<span class="anchor" id="line-73"></span> set “button1::matcolor” “1,1,1,0.5” ;
|
||
<span class="anchor" id="line-74"></span> }
|
||
<span class="anchor" id="line-75"></span>
|
||
<span class="anchor" id="line-76"></span> onESC
|
||
<span class="anchor" id="line-77"></span> {
|
||
<span class="anchor" id="line-78"></span> set “cmd” “close” ;
|
||
<span class="anchor" id="line-79"></span> }
|
||
<span class="anchor" id="line-80"></span>
|
||
<span class="anchor" id="line-81"></span> onNamedEvent Foo
|
||
<span class="anchor" id="line-82"></span> {
|
||
<span class="anchor" id="line-83"></span> set “button2::matcolor” “1,0,1,1” ;
|
||
<span class="anchor" id="line-84"></span> }
|
||
<span class="anchor" id="line-85"></span></pre><span class="anchor" id="line-86"></span><span class="anchor" id="line-87"></span><p class="line867">
|
||
<h3 id="head-1c138e69b755291b2fd8efc6334962c31fbdb3d4">Referencing Vec4s and Floats</h3>
|
||
<span class="anchor" id="line-88"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-89"></span>Referencing floats defined in the Desktop is very simple. If statements often use floats to choose when to perform other actions: <span class="anchor" id="line-90"></span><span class="anchor" id="line-91"></span><p class="line867"><span class="anchor" id="line-92"></span><pre> if (“desktop::check1” == 0) {
|
||
<span class="anchor" id="line-93"></span> // performs an action
|
||
<span class="anchor" id="line-94"></span> }
|
||
<span class="anchor" id="line-95"></span></pre><span class="anchor" id="line-96"></span><span class="anchor" id="line-97"></span><p class="line874">Floats can also be changed using the set command: <span class="anchor" id="line-98"></span><span class="anchor" id="line-99"></span><p class="line867"><span class="anchor" id="line-100"></span><pre> set “desktop::check1” “1” ;
|
||
<span class="anchor" id="line-101"></span></pre><span class="anchor" id="line-102"></span><span class="anchor" id="line-103"></span><p class="line867"><span class="anchor" id="definevec4"></span> <span class="anchor" id="line-104"></span>The syntax for using vec4s is slightly different, but straightforward. The following example uses the “yellowtext_on” and “yellowtext_off” vec4s we defined in our example Desktop script: <span class="anchor" id="line-105"></span><span class="anchor" id="line-106"></span><p class="line867"><span class="anchor" id="line-107"></span><pre> transition “button1::forecolor” “$desktop::yellowtext_off” “$desktop::yellowtext_on” “200” ;
|
||
<span class="anchor" id="line-108"></span></pre><span class="anchor" id="line-109"></span><span class="anchor" id="bottom"></span></div><p id="pageinfo" class="info" lang="en" dir="ltr">Floats, Definevec4, and NamedEvents (last edited 2005-11-07 19:39:21 by <span title="MattVainio @ 67.129.250.254[67.129.250.254]"><a class="nonexistent" href="./MattVainio.html" title="MattVainio @ 67.129.250.254[67.129.250.254]">MattVainio</a></span>)</p>
|
||
|
||
<div id="pagebottom"></div>
|
||
</div>
|
||
|
||
|
||
<div id="footer">
|
||
<ul class="editbar"><li><span class="disabled">Immutable Page</span></li><li><a href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=info">Info</a></li><li><a href="./Floats%2C_Definevec4%2C_and_NamedEvents?action=AttachFile">Attachments</a></li><li>
|
||
<form class="actionsmenu" method="get" action="">
|
||
<div>
|
||
<label>More Actions:</label>
|
||
<select name="action"
|
||
onchange="if ((this.selectedIndex != 0) &&
|
||
(this.options[this.selectedIndex].disabled == false)) {
|
||
this.form.submit();
|
||
}
|
||
this.selectedIndex = 0;">
|
||
<option value="raw">Raw Text</option>
|
||
<option value="print">Print View</option>
|
||
<option value="RenderAsDocbook">Render as Docbook</option>
|
||
<option value="refresh">Delete Cache</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="SpellCheck">Check Spelling</option>
|
||
<option value="LikePages">Like Pages</option>
|
||
<option value="LocalSiteMap">Local Site Map</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="RenamePage" disabled class="disabled">Rename Page</option>
|
||
<option value="DeletePage" disabled class="disabled">Delete Page</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="MyPages">My Pages</option>
|
||
<option value="SubscribeUser">Subscribe User</option>
|
||
<option value="show" disabled class="disabled">------------</option>
|
||
<option value="Despam">Remove Spam</option>
|
||
<option value="PackagePages">Package Pages</option>
|
||
</select>
|
||
<input type="submit" value="Do">
|
||
</div>
|
||
<script type="text/javascript">
|
||
<!--// Init menu
|
||
actionsMenuInit('More Actions:');
|
||
//-->
|
||
</script>
|
||
</form>
|
||
</li></ul>
|
||
|
||
<ul id="credits">
|
||
<li><a href="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a></li><li><a href="http://www.python.org/">Python Powered</a></li><li><a href="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a></li>
|
||
</ul>
|
||
|
||
|
||
</div>
|
||
</body>
|
||
</html>
|
||
|