fixes/aliasinit
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6414 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -210,6 +210,11 @@ docargument [A] [the alias to check for] [] [0];
|
||||
docargument [B] [the optional block of code to ensure that the alias contains] [] [0];
|
||||
docexample [checkinit mapstartalways] [Output: if alias mapstartalways does not exist, this command initializes it.];
|
||||
docexample [checkinit mapstartalways [ echo New map, good luck! ]] [Output: if alias mapstartalways does not exist, it is initialized, and if the block of code "[ echo New map, good luck! ]" does not exist within the aliases contents, this command adds it.];
|
||||
docident [aliasinit] [Initializes a group of aliases using checkinit.];
|
||||
docargument [L] [the list of aliases to check for] [] [0];
|
||||
docargument [B] [the optional block of code to ensure the aliases contain] [] [0];
|
||||
docexample [aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5"] [Checks to ensure that all 5 aliases listed exist, if not, it initializes them.];
|
||||
docexample [aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5" 0] [Checks to ensure that all 5 aliases listed exist, if not, it initializes them to 0.];
|
||||
docsection [General]
|
||||
docident [addserver] [Adds a server to the list of server to query in the server list menu.];
|
||||
docargument [S] [the address of the server (hostname or IP)] [] [0];
|
||||
|
||||
@@ -119,7 +119,7 @@ menuitemslider "# of milliseconds before teleporting: " 10000 180000 "$timeUntil
|
||||
menuitemslider "Maximum # of bots in survival mode: " 10 50 "$survMaxBots" 2 [] [ survMaxBots = $arg1 ]
|
||||
menuitemslider "Spam survival mode messages: " 0 1 "$spamSurvMsgs" 1 [ "no" "yes" ] [ spamSurvMsgs = $arg1 ]
|
||||
menuitem [] -1
|
||||
menuitem " Back" [ closemenu "Survival Mode - Customize" ]
|
||||
menuitem " Back" [ closemenu "Survival Mode - Customize" ]
|
||||
|
||||
newmenu "Creating bot waypoints"
|
||||
|
||||
|
||||
+3
-3
@@ -232,10 +232,10 @@ add2alias = [
|
||||
addOnLoadOnce = [ add2alias mapstartonce $arg1 ]
|
||||
addOnLoadAlways = [ add2alias mapstartalways $arg1 ]
|
||||
addOnQuit = [ add2alias onQuit $arg1 ]
|
||||
checkinit = [ if (> $numargs 0) [ if (! (checkalias $arg1)) [ $arg1 = "" ]; if (> $numargs 1) [ if (! (strstr (getalias $arg1) $arg2)) [ add2alias $arg1 $arg2 ] ] ] ]
|
||||
|
||||
// add2list - Quickly append an element to a list without add2alias'es ";"
|
||||
checkinit = [ if (> $numargs 0) [ if (! (checkalias $arg1)) [ $arg1 = ""; if (> $numargs 1) [ add2alias $arg1 $arg2 ] ] ] ]
|
||||
aliasinit = [ loop ail (listlen $arg1) [ if (< $numargs 2) [ checkinit (at $arg1 $ail) ] [ checkinit (at $arg1 $ail) $arg2 ] ] ]
|
||||
add2list = [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ]
|
||||
|
||||
// rrnd - Returns a ranged random integer.
|
||||
rrnd = [ + (rnd (- $arg2 $arg1)) $arg1 ]
|
||||
|
||||
|
||||
+3
-6
@@ -9,17 +9,14 @@
|
||||
// * If the player dies, or leaves the "zone" for too long of a duration, the game ends.
|
||||
// * Total seconds survived, and total number of enemies killed during, are reported as stats when the game ends.
|
||||
|
||||
checkSurvAliases = [ loop csa (listlen $arg1) [ if (! (checkalias (at $arg1 $csa))) [ (at $arg1 $csa) = $arg2 ] ] ]
|
||||
|
||||
survResetAliases = "gotCheckPoint lastCheckPoint survIsFinished startedSurvival startedOBCount startPreSurvMillis startSurvMillis survKills survTeleported"
|
||||
|
||||
resetSurvAliases = [
|
||||
loop rsa (listlen $survResetAliases) [ (at $survResetAliases $rsa) = 0 ]
|
||||
checkSurvAliases survMap (rnd (listlen $defaultmaps))
|
||||
checkSurvAliases survBotsToAdd 1; checkSurvAliases "spamSurvMsgs survDifficulty" 0; checkSurvAliases survNumBots 12; checkSurvAliases survMaxBots 32; checkSurvAliases timeBetChkPts 60000; checkSurvAliases timeUntilTele 120000
|
||||
aliasinit survBotsToAdd 1; aliasinit "spamSurvMsgs survDifficulty" 0; aliasinit survNumBots 12; aliasinit survMaxBots 32; aliasinit timeBetChkPts 60000; aliasinit timeUntilTele 120000
|
||||
]
|
||||
|
||||
resetSurvAliases
|
||||
resetSurvAliases; if (! (checkalias afterinit)) [ afterinit = "" ]; if (! (strstr $afterinit survMap)) [ add2alias afterinit [ if (! (checkalias survMap)) [ survMap = (rnd (listlen $defaultmaps)) ] ] ]
|
||||
|
||||
survival = [
|
||||
storesets "positiontype" tmpSurvSets; add2list tmpSurvSets $survNumBots; curSurvDifficulty = 0; positiontype 1; resetSurvAliases
|
||||
@@ -133,6 +130,6 @@ endSurvival = [
|
||||
]
|
||||
|
||||
// List of aliases that need to be cleared from saved.cfg on quit:
|
||||
survAliases = "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis gotCheckPoint increaseDifficulty isInZone lastCheckPoint midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startedOBCount startedSurvival startOBCount startOBMillis startPreSurvMillis startSurvival startSurvMillis survIsFinished survival_test survKills survMapIndex survOfcZones survTeleported tmpSCtr tmpSurvCtr tmpSurvInt tmpSurvSets tmp_survstr tmpSurvZone tmpZoneCenter zone checkSurvAliases survResetAliases survAliases"
|
||||
survAliases = "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis gotCheckPoint increaseDifficulty isInZone lastCheckPoint midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startedOBCount startedSurvival startOBCount startOBMillis startPreSurvMillis startSurvival startSurvMillis survIsFinished survival_test survKills survMapIndex survOfcZones survTeleported tmpSCtr tmpSurvCtr tmpSurvInt tmpSurvSets tmp_survstr tmpSurvZone tmpZoneCenter zone aliasinit survResetAliases survAliases"
|
||||
|
||||
addListOnQuit $survAliases
|
||||
@@ -801,6 +801,7 @@
|
||||
</arguments>
|
||||
<references>
|
||||
<identifierReference identifier="checkinit"/>
|
||||
<identifierReference identifier="aliasinit"/>
|
||||
</references>
|
||||
</command>
|
||||
|
||||
@@ -822,6 +823,29 @@
|
||||
</arguments>
|
||||
<references>
|
||||
<identifierReference identifier="checkalias"/>
|
||||
<identifierReference identifier="aliasinit"/>
|
||||
</references>
|
||||
</command>
|
||||
|
||||
<command name="aliasinit">
|
||||
<description>Initializes a group of aliases using checkinit.</description>
|
||||
<examples>
|
||||
<example>
|
||||
<code><![CDATA[aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5"]]></code>
|
||||
</explanation>Checks to ensure that all 5 aliases listed exist, if not, it initializes them.</explanation>
|
||||
</example>
|
||||
<example>
|
||||
<code><![CDATA[aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5" 0]]></code>
|
||||
</explanation>Checks to ensure that all 5 aliases listed exist, if not, it initializes them to 0.</explanation>
|
||||
</example>
|
||||
</examples>
|
||||
<arguments>
|
||||
<argument token="L" description="the list of aliases to check for"/>
|
||||
<argument token="B" description="the optional block of code to ensure the aliases contain"/>
|
||||
</arguments>
|
||||
<references>
|
||||
<identifierReference identifier="checkalias"/>
|
||||
<identifierReference identifier="checkinit"/>
|
||||
</references>
|
||||
</command>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user