docs: removed old control documentation

Tobias Zwick 2011-07-31 19:13:07 +02:00
parent 480ff384f8
commit e482c9a5cd
1 changed files with 0 additions and 40 deletions

View File

@ -340,46 +340,6 @@
</table>
</text>
<h id="Control-Funktionen">Control Functions</h>
<text>At every player command (left, right, up, down dig, throw, special) the engine calls the corresponding control function in the script of the currently controlled object of the player. If the function is defined and returns <code>true</code>, the internal handling of the player command is skipped. If the function is not defined or returns <code>false</code>, internal processing is done.</text>
<code>func ControlThrow()
{
<emlink href="script/fn/if.html">if</emlink> (<emlink href="script/fn/FindContents.html">FindContents</emlink>(SPER))
<emlink href="script/fn/return.html">return</emlink>(<emlink href="script/fn/SetAction.html">SetAction</emlink>(&quot;ThrowSpear&quot;));
<emlink href="script/fn/return.html">return</emlink> 0;
}
</code>
<text>If a clonk with this script is carrying a spear and the player hits the throw button, the clonk performs a special throw action. In this case, however, the command is not passed to the other selected clonks as usual. If the clonk does not carry a spear, the function returns 0 and the regular throwing action is performed.</text>
<text>Control functions are also transferred to grabbed (indirectly controlled) objects.</text>
<text>Single and double clicks: for each player command the engine will first call the simple variant of the control function (e.g. ControlDown) and then the more specific variant (i.e. ControlDownSingle or ControlDownDouble). When overloading control functions you should pay attention to catch the correct variant to overload.</text>
<text>ContainedControl: if a directly controlled object is contained in another object (container) the basic commands down (exit), throw (put), up (buy at base), dig (sell at base) are evaluated internally first. Then the command is passed to the container for special handling there. Exception: the commands ControlSpecial, ControlSpecial2, and ControlWheepUp/Down are only direct commands and are not passed to the container.</text>
<text>ControlCommnd: the engine also performs <a href="#ObjektCallsderEngine">object calls</a> for independently executed commands which have been given directly by the player (i.e. by mouse control).</text>
<code>func ControlCommand(string command, object target, int x, int y, object target2, int data, object command_object)
{
// Ein Kommando mit Zielobjekt
<emlink href="script/fn/if.html">if</emlink> (target)
<emlink href="script/fn/Message.html">Message</emlink>(&quot;Befehl: %s Ziel: %s Koordinaten: %d/%d&quot;, command, target-&gt;GetName(), x, y);
// Ein Kommando ohne Zielobjekt
else
<emlink href="script/fn/Message.html">Message</emlink>(&quot;Befehl: %s Koordinaten: %d/%d&quot;, command, x, y);
// Kommando nicht abfangen
<emlink href="script/fn/return.html">return</emlink>(0);
}
</code>
<text>By returning <code>true</code> the command can be intercepted and internal handling can be prevented. "command_object" is always the object receiving the command, even if the call was transferred by a contained object (see VehicleControl in <emlink href="definition/defcore.html">DefCore</emlink>). The script command <emlink href="script/fn/SetCommand.html">SetCommand</emlink> does not cause ControlCommand calls.</text>
<text>ControlCommand calls are also transferred to grabbed objects or objects controlled from the inside if these have the VehicleControl flag set. This transferred call is made after the ControlCommand call to the clonk, but before internal handling. So the vehicle, too, has the opportunity to intercept and overload the command.</text>
<text>ControlWheelUp and ControlWheelDown are generated by the mouse wheel (and only when not in an object menu). If they are not overloaded, they will cause ShiftContents commands. That in return could be intercepted in ControlContents.</text>
<text>ControlContents is called when an inventory change is made by direct mouse click, mouse wheel rotation, or a ShiftContents script command (e.g. in ControlSpecial or ControlSpecial2). Here you can perform special actions such as the arming of weapons or custom inventory sounds. If the function is intercepted with a return value <code>true</code>, the inventory change is prevented. Otherwise, the first object with the given id moves to the front of the inventory and a Selection call is made to the newly selected object. If the latter call is not overloaded, the sound effect "Grab" is played for the container object.</text>
<h id="Context-Funktionen">Context Functions</h>
<text>Context functions (Context_ in object scripts) are displayed as entries in the context menu of the object. When calling a context function, the engine will pass a pointer to the calling object as the first parameter (with crew members this is always the object itself). Context functions should always have a valid function description and be declared pubic.</text>
<code>public func ContextConstruction(object caller)
{
[Bauauftrag|Image=CXCN|Condition=HasKnowledge]
SetCommand(this, &quot;Construct&quot;);
return true;
}
</code>
<text>If the condition field is used, the context function is only displayed as a menu entry if the script function defined by the condition field (in this case HasKnowledge) is found in the object's script and returns <code>true</code>. The menu object is passed as the first parameter to the condition function.</text>
</part>
<author>sulai</author><date>2003-11</date>
<author>Sven2</author><date>2004-02</date>