Huge problems with "While" scripts
nwfan87
Member Posts: 99
I'm having huge problems getting while scripts to work. Here is an example of the type of script I'm talking about, the sort you might have say, if you have a party enter a really cold room and want to do cold damage to them, as an example
I'm putting this script on AreaHeartbeat, because I want the script to fire every round.
The trouble I'm having is that I get the too many operands error in game, other time the game will crash and sometimes the script file will even corrupt, requiring a brand new script file to be made.
I would prefer using this sort of script if possible otherwise I would need to create a script many times longer script to define every object that could possibly enter a radius
Any scripting Wizards have advice?
void main() { //DEFINE STUFF // object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, ///); while(GetIsObjectValid(///)) { if (// WHATEVER CHECKS)) { //DO WHATEVER } } oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, ///); } }
I'm putting this script on AreaHeartbeat, because I want the script to fire every round.
The trouble I'm having is that I get the too many operands error in game, other time the game will crash and sometimes the script file will even corrupt, requiring a brand new script file to be made.
I would prefer using this sort of script if possible otherwise I would need to create a script many times longer script to define every object that could possibly enter a radius
Any scripting Wizards have advice?
0
Comments
TR
The code you show is not all that helpful due to all the stuff you cut out but... you have the loop closing } before you change your loop condition variable, so that, as shown (aside from it not compiling), will be an infinite loop. You have to update oTarget in the loop. If you post the actual script without cutting out bits we can help more.
That said if you have a large number of objects you could hit TMI just in the loop but that is very unlikely. It used to happen some in the various AI routines but usually in modified versions and with loops in loops etc. Also if you create an object in the shape in your loop that could be a problem too... but again, not enough info in that script snippet.
@meaglyn, here is a better and compiled example of the sort of thing I meant.
I know certain objects for various reasons do not cast certain spells very well, but really, just asking about the logic of the script.