172 lines
6.3 KiB
HTML
172 lines
6.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Miscellaneous variables and functions</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
<!--START-->
|
|
|
|
<h3>Miscellaneous variables and functions</h3>
|
|
|
|
Here are some variables and functions that deal with errors.
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>error_occurred</b></tt>
|
|
Indicates whether an error has occurred.<br>
|
|
<tt><b>error_last</b></tt>
|
|
String indicating the last error message.<br>
|
|
<tt><b>show_debug_message(str)</b></tt>
|
|
Shows the string in debug mode.<br>
|
|
<tt><b>debug_mode</b></tt>
|
|
This read-only variable indicates whether the game is running in debug mode.<br>
|
|
</blockquote>
|
|
|
|
The following variables can be used to make sure your code will work for the appropriate version and edition
|
|
of <i>Game Maker</i>.
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>gamemaker_pro</b></tt>
|
|
Indicates whether the game is created with the Pro Edition.<br>
|
|
<tt><b>gamemaker_registered</b></tt>
|
|
Same as <tt>gamemaker_pro</tt><br>
|
|
<tt><b>gamemaker_version</b></tt>
|
|
The version of <i>Game Maker</i>. This is an integer. For version 8.0 this can be
|
|
anything between 800 and 809. For version 8.1 this will be something between
|
|
810 and 819, etc. So never check a particular version but better check for a range.
|
|
This variable is not available in version before 800.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
The following functions exist that allow you to check whether certain variables
|
|
exist and with which you can set variables and get their values. In all
|
|
these functions the variable name is passed as a string!
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>variable_global_exists(name)</b></tt>
|
|
Returns whether a global variable with the given name (a string) exists.<br>
|
|
<tt><b>variable_local_exists(name)</b></tt>
|
|
Returns whether a local variable with the given name (a string) exists for the current instance.<br>
|
|
<tt><b>variable_global_get(name)</b></tt>
|
|
Returns the value of the global variable with the given name (a string).<br>
|
|
<tt><b>variable_global_array_get(name,ind)</b></tt>
|
|
Returns the value of index ind of the global array variable with the given name (a string).<br>
|
|
<tt><b>variable_global_array2_get(name,ind1,ind2)</b></tt>
|
|
Returns the value of index ind1,ind2 of the global 2-dimensional array variable
|
|
with the given name (a string).<br>
|
|
<tt><b>variable_local_get(name)</b></tt>
|
|
Returns the value of the local variable with the given name (a string).<br>
|
|
<tt><b>variable_local_array_get(name,ind)</b></tt>
|
|
Returns the value of index ind of the local array variable with the given name (a string).<br>
|
|
<tt><b>variable_local_array2_get(name,ind1,ind2)</b></tt>
|
|
Returns the value of index ind1,ind2 of the local 2-dimensional array
|
|
variable with the given name (a string).<br>
|
|
<tt><b>variable_global_set(name,value)</b></tt>
|
|
Sets the global variable with the given name (a string) to the given value.<br>
|
|
<tt><b>variable_global_array_set(name,ind,value)</b></tt>
|
|
Sets the index ind in the global array variable with the given name (a string)
|
|
to the given value.<br>
|
|
<tt><b>variable_global_array2_set(name,ind1,ind2,value)</b></tt>
|
|
Sets the index ind1,ind2 in the global 2-dimensional array variable with the
|
|
given name (a string) to the given value.<br>
|
|
<tt><b>variable_local_set(name,value)</b></tt>
|
|
Sets the local variable with the given name (a string) to the given value.<br>
|
|
<tt><b>variable_local_array_set(name,ind,value)</b></tt>
|
|
Sets the index ind in the local array variable with the given name
|
|
(a string) to the given value.<br>
|
|
<tt><b>variable_local_array2_set(name,ind1,ind2,value)</b></tt>
|
|
Sets the index ind1,ind2 in the local 2-dimensional array variable with
|
|
the given name (a string) to the given value.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
For example, you can write:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<pre>
|
|
{
|
|
<b>if</b> variable_global_exists('ammunition')
|
|
<b>global</b>.ammunition += 1
|
|
<b>else</b>
|
|
<b>global</b>.ammunition = 0
|
|
}
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>
|
|
You can also use these functions to pass variables to a script in a sort of by-reference
|
|
way, by passing their names as strings and using the functions to change them.
|
|
|
|
<p>
|
|
You can change the program priority using the following function:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>set_program_priority(priority)</b></tt>
|
|
Sets the priority for the program. You can indicate a value between -3 and +3.
|
|
A value of -3 means that the program will only run if no other process on the
|
|
computer requires processing time, or stated differently, when all other
|
|
processes are idle. Values of -2 and -1 are below normal, so other processes
|
|
will get priority. 0 is the normal value. +1 and +2 give a higher priority,
|
|
resulting possibly in higher speed and smoother game flow. But other
|
|
processes will get much less processing time. +3 indicates real-time mode.
|
|
In real-time mode basically all time is allotted to the game. This can
|
|
lead to serious problems with any other applications running on the computer.
|
|
Also keyboard events and e.g. the pressing of the close box might no longer
|
|
be recorded by Windows. So only use this if you want all the processor time.
|
|
Also better check carefully before using it and save the game before running.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
Finally, you can use the following function to set the title of the application:
|
|
</p>
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>set_application_title(title)</b></tt>
|
|
Sets the title of the application to the given string. The title is for example shown
|
|
in the task bar.<br>
|
|
</blockquote>
|
|
|
|
|
|
|
|
<!--END-->
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
program priority
|
|
priority
|
|
application title
|
|
taskbar
|
|
|
|
error_occurred
|
|
error_last
|
|
show_debug_message()
|
|
debug_mode
|
|
gamemaker_pro
|
|
gamemaker_registered
|
|
gamemaker_version
|
|
variable_global_exists()
|
|
variable_global_get()
|
|
variable_global_array_get()
|
|
variable_global_array2_get()
|
|
variable_global_set()
|
|
variable_global_array_set()
|
|
variable_global_array2_set()
|
|
variable_local_exists()
|
|
variable_local_get()
|
|
variable_local_array_get()
|
|
variable_local_array2_get()
|
|
variable_local_set()
|
|
variable_local_array_set()
|
|
variable_local_array2_set()
|
|
set_program_priority()
|
|
set_application_title()
|
|
|
|
--> |