Reduce var usage

This commit is contained in:
ineedbots 2021-06-04 14:15:21 -06:00
parent a18aa4c446
commit f109ab8fbb
3 changed files with 29 additions and 6 deletions

View File

@ -1930,7 +1930,7 @@ killWalkOnEvents()
self endon("disconnect"); self endon("disconnect");
self endon("death"); self endon("death");
ret = self waittill_any_return("flash_rumble_loop", "new_enemy", "new_goal_internal", "goal_internal", "bad_path_internal"); self waittill_any("flash_rumble_loop", "new_enemy", "new_goal_internal", "goal_internal", "bad_path_internal");
waittillframeend; waittillframeend;
@ -1944,12 +1944,11 @@ doWalkScriptNotify()
{ {
self endon("disconnect"); self endon("disconnect");
self endon("death"); self endon("death");
self endon("kill_goal");
ret = self waittill_any_return("goal_internal", "kill_goal", "bad_path_internal"); if (self waittill_either_return("goal_internal", "bad_path_internal") == "goal_internal")
if (ret == "goal_internal")
self notify("goal"); self notify("goal");
else if (ret == "bad_path_internal") else
self notify("bad_path"); self notify("bad_path");
} }

View File

@ -51,6 +51,9 @@ connected()
self thread onGiveLoadout(); self thread onGiveLoadout();
self thread onKillcam(); self thread onKillcam();
wait 0.1;
self.challengeData = [];
} }
/* /*

View File

@ -447,6 +447,27 @@ getValidTube()
return undefined; return undefined;
} }
/*
helper
*/
waittill_either_return_(str1, str2)
{
self endon(str1);
self waittill(str2);
return true;
}
/*
Returns which string gets notified first
*/
waittill_either_return(str1, str2)
{
if (!isDefined(self waittill_either_return_(str1, str2)))
return str1;
return str2;
}
/* /*
Returns a random grenade in the bot's inventory. Returns a random grenade in the bot's inventory.
*/ */