As most scripers know, AppOnIdle is invoked about once every second. There have been various attempts to create methods that can have something being called more often. This topic's intent is to simply list some current ways, and discuss advantages of one over another, and also to discuss other possible methods of accomplishing this.
Bullet BotConcept:A bot is spawned, usually outside the play field, and bullets are created above him. Gravity takes effect and falls onto the bot, invoking OnPlayerDamage. The result is set to 0, or a negative number.
Advantages:-Custom intervals (although difficult to set, and make even)
-Avoids server deaths by calling any function less often (which cannot be done with Poly Hurt Bot) if interval is high enough
Disadvantages:-May need a custom map, or a map with room outside the map for the idle bot to sit on
-Gravity modifiers may ruin this
-Timing is hard to tweak to make regular intervals
-Bullets may move the bot slightly, and because MovePlayer does not work with bots, it may be necessary to respawn the bot once in a while; it could be possible to do tests to see if its working properly (location of bot, or if bot stops receiving damage)
Poly Hurt BotConcept:A bot is spawned on top of a hurts, deadly, or bloody deadly polygon, and simply sits there. OnPlayerDamage constantly gets called, and setting 0 or a negative result will keep the bot alive.
Advantages:-Regular intervals (needs to be tested for exact number; if I recall correctly, it is once per tick); these can be filtered through to be used at your own custom intervals
Disadvantages:-May require a custom map (more often than Bullet Bot), or a map with an inaccessible area with a hurt or other varying polygon type for the bot to sit on
Threaded LoopConcept:Create a thread that calls a function which will do an infinite loop. This loop will use
Sleep and call a new Idle function. It is optional to call this function in a new thread or not. If the function is expected to take time, it should be called in a new thread (as we don't want our idle loop to hold up)
Advantages:-Easy to create
-User specific intervals, which may be in ticks, milliseconds, or anything else
-Avoids server deaths by calling any function less often (which cannot be done with Poly Hurt Bot) if interval is high enough
Disadvantages:-Scripting core thread usage is unstable sometimes; it really depends on where you host it, and how stressed the server is, as I've actually rarely had any huge issues with threads except in the case where I create tons of them. If I did have any issues, I just recreate the thread.
-If the loop dies for whatever reason, it may be necessary to do checks and recreate the loop (its possible for the thread to die, without the server flipping out)
Admin ConnectionConcept:Having an external bot connect to a server as an admin, and constantly send packets of data, and using OnAdminMessage as the main event for faster idle.
Advantages:-User specific intervals
Disadvantages:-Requires external application (unless connected to self via sockets)
-May cause internet lag on the server (depending on how good the internet is)
-May cause server lag if other scripts are also heavially parsing OnAdminMessage
-Lag may cause the interval to vary from time to time.
Bot FlagConcept:Having a bot sit still, and spawning a flag on top of or above the bot. The flag can be the team opposing the bot's team, or friendly, but would require ReturnFlaging it.
Advantages:Disadvantages:-Message saying bot either returned or grabbed the flag very often, spamming the players' consoles.
NTS: example code
NTS: finish checking posts and updating main topic