Burgeoning Battle Gamma Walker White Posted April 4, 2004 Share Posted April 4, 2004 As I continue to play with AvernumScript, I find issues that I lump into three categories: (1) Bugs that need to be fixed, (2) Calls that I wish existed because I cannot fake, and (3) Things that don't work like I thought and need to be better documented. There are formal channels for (1), and Kelandon has created a thread for (2). This thread is for (3), the type of things that appear on the tech support page . That page is a stopgap for the really extreme problems. This thread is for people to post things they do not legitimately understand about the system and may need to appear in later documentation. Here is something to get us started. Boolean expressions in AvernumScript do not seem to short circuit. To see what I mean by this, consider the line of code if (who_hit_me() >= 0 && dist_to_char(who_hit_me() <= 2) { This checks if we were hits and that the offender is close (not an archer). In most programming languages, if who_hit_me() is negative, the script will not bother with the dist_to_char() call. One part is false, so the whole thing must be false. Not true in AvernumScript. If will make both calls. So if no one hit you, you will get an error here (because dist_to_char(-1) is bad). It also means that long complicated boolean expressions are inefficient. Is this a bug for Jeff to fix? Absolutely not. It was a reasonable design decision on his behalf. But this is something we need to be aware when writing scripts. Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody wz. As Posted April 6, 2004 Share Posted April 6, 2004 Maybe the error is from a missing parenthesis? There should be a ")" before the "<=2". Link to comment Share on other sites More sharing options...
Burgeoning Battle Gamma Walker White Posted April 6, 2004 Author Share Posted April 6, 2004 Quote: Originally written by wizardr6:Maybe the error is from a missing parenthesis? There should be a ")" before the "<=2". Oh. That's a typo in the post. It's okay in the actual script (which is actually more complicated. Compareif (who_hit_me() >= 0 && dist_to_char(who_hit_me() <= 2)) { which has problems withif (who_hit_me() >= 0) { if (dist_to_char(who_hit_me() <= 2)) { which works. I have tested the function. It's a short-circuit issue. Link to comment Share on other sites More sharing options...
Garrulous Glaahk UA Posted April 6, 2004 Share Posted April 6, 2004 That is a bug IMO, and something that Jeff needs to fix. I'll be sorely dissapointed if I can't use long expressions in a single if() like that when BoA for win is out. Link to comment Share on other sites More sharing options...
Recommended Posts