refactor: schedulecalls without object can now be made from object context

(parameter obj is not automatically filled with this if nil)
Tobias Zwick 2011-07-31 19:27:26 +02:00
parent e482c9a5cd
commit ecd6de1d65
8 changed files with 25 additions and 21 deletions

View File

@ -5060,8 +5060,8 @@ msgid "Converts an object definition id into a number which can be used as index
msgstr "Wandelt eine Objektdefinitions-ID in eine Zahl um, die als Spaltenidentifikator für <placeholder-1/> verwendet werden kann. Diese Funktion ist dann interessant, wenn ein Objekt auf das Scoreboard zugreifen will, aber dabei sicher stellen muss, dass es nicht dieselbe ID wie ein anderes Objekt verwendet."
#: sdk/script/fn/ScheduleCall.xml:16(desc)
msgid "Object in which to call the function. Can be <code>nil</code> in local calls."
msgstr "Objekt, in dem die Funktion aufgerufen werden soll. <code>nil</code> für lokalen Aufruf."
msgid "Object in which to call the function. <code>nil</code> for no object context."
msgstr "Objekt, in dem die Funktion aufgerufen werden soll. <code>nil</code> für ohne Objektkontext."
#: sdk/script/fn/ScheduleCall.xml:21(desc)
msgid "Name of the function to call."
@ -5098,8 +5098,8 @@ msgid "Script to be executed."
msgstr "Auszuführendes Script"
#: sdk/script/fn/Schedule.xml:31(desc)
msgid "Object in which the call is to be made. Can be <code>nil</code> in local calls."
msgstr "Objekt, in dem das Script ausgeführt werden soll. <code>nil</code> für lokalen Aufruf."
msgid "Object in which the call is to be made. <code>nil</code> for no object context."
msgstr "Objekt, in dem das Script ausgeführt werden soll. <code>nil</code> für ohne Objektkontext."
#: sdk/script/fn/Schedule.xml:35(desc)
msgid "Executes a specified script command after a specified delay."
@ -9185,8 +9185,8 @@ msgid "Closes the container's menu."
msgstr "Schließt das Menü des eigenen Behälters."
#: sdk/script/fn/ClearScheduleCall.xml:16(desc)
msgid "Object for which to cancel scheduled function calls. Can be 0 for the calling object."
msgstr "Objekt, für das verzögerte Funktionsaufrufe abgebrochen werden sollen. 0 für aufrufendes Objekt."
msgid "Object for which to cancel scheduled function calls. <code>nil</code> for scheduled calls without object context."
msgstr "Objekt, für das verzögerte Funktionsaufrufe abgebrochen werden sollen. <code>nil</code> für verzögerte Funktionsaufrufe ohne Objektkontext"
#: sdk/script/fn/ClearScheduleCall.xml:21(desc)
msgid "Name of the scheduled function."

View File

@ -13,7 +13,7 @@
<param>
<type>object</type>
<name>obj</name>
<desc>Object for which to cancel scheduled function calls. Can be 0 for the calling object.</desc>
<desc>Object for which to cancel scheduled function calls. <code>nil</code> for scheduled calls without object context.</desc>
</param>
<param>
<type>string</type>

View File

@ -10,6 +10,11 @@
<syntax>
<rtype>bool</rtype>
<params>
<param>
<type>object</type>
<name>obj</name>
<desc>Object in which the call is to be made. Can be <code>nil</code> for no object context.</desc>
</param>
<param>
<type>string</type>
<name>script</name>
@ -25,11 +30,6 @@
<name>repeat</name>
<desc>Number of calls. If 0 or not specified, the call is made exactly once.</desc>
</param>
<param>
<type>object</type>
<name>obj</name>
<desc>Object in which the call is to be made. Can be <code>nil</code> in local calls.</desc>
</param>
</params>
</syntax>
<desc>Executes a specified script command after a specified delay.</desc>

View File

@ -13,7 +13,7 @@
<param>
<type>object</type>
<name>obj</name>
<desc>Object in which to call the function. Can be <code>nil</code> in local calls.</desc>
<desc>Object in which to call the function. <code>nil</code> for no object context.</desc>
</param>
<param>
<type>string</type>

View File

@ -50,7 +50,7 @@ protected func RelaunchPlayer(int plr, int killer)
SortScoreboard(Scoreboard_Death->GetDeathCol(), true);
SortScoreboard(Scoreboard_Kill->GetKillCol(), true);
DoScoreboardShow(1, plr + 1);
Schedule(Format("DoScoreboardShow(-1, %d)", plr + 1), 35 * MIME_ShowBoardTime);
Schedule(this,Format("DoScoreboardShow(-1, %d)", plr + 1), 35 * MIME_ShowBoardTime);
NotifyHUD();
return; // _inherited(plr, killer, ...);
}

View File

@ -92,7 +92,7 @@ protected func RelaunchPlayer(int plr, int killer)
SortScoreboard(Scoreboard_Kill->GetKillCol(), true);
SortScoreboard(Scoreboard_Relaunch->GetRelaunchCol(), true);
DoScoreboardShow(1, plr + 1);
Schedule(Format("DoScoreboardShow(-1, %d)", plr + 1), 35 * MIME_ShowBoardTime);
Schedule(this,Format("DoScoreboardShow(-1, %d)", plr + 1), 35 * MIME_ShowBoardTime);
return; // _inherited(plr, killer, ...);
}

View File

@ -28,7 +28,7 @@ private func Deflate()
SetAction("Deflate");
SetComDir(COMD_None);
}
Schedule("Pack()",20); //EndCall doesn't work. >:(
Schedule(this,"Pack()",20); //EndCall doesn't work. >:(
}
private func DeflateEffect()

View File

@ -6,13 +6,15 @@
--*/
// Executes a script repetitively with delay.
global func Schedule(string script, int interval, int repeats, object obj)
global func Schedule(object obj, string script, int interval, int repeats)
{
// Defaults.
if (!repeats)
repeats = 1;
if (!obj)
obj = this;
// in CR, it was possible to leave out obj in local calls.
// In OC, obj=nil means schedule without object context
//if (!obj)
// obj = this;
// Create effect.
var effect = AddEffect("IntSchedule", obj, 1, interval, obj);
if (!effect)
@ -38,8 +40,10 @@ global func ScheduleCall(object obj, string function, int interval, int repeats,
// Defaults.
if (!repeats)
repeats = 1;
if (!obj)
obj = this;
// in CR, it was possible to leave out obj in local calls.
// In OC, obj=nil means schedule without object context
//if (!obj)
// obj = this;
// Create effect.
var effect = AddEffect("IntScheduleCall", obj, 1, interval, obj);
if (!effect)