| Yoko http://forum.yoko.com.ua/ |
|
| IF Question http://forum.yoko.com.ua/viewtopic.php?f=1&t=709 |
Page 1 of 1 |
| Author: | clagio [ 2004-06-28 07:42:30 ] |
| Post subject: | IF Question |
i noticed a thing and i can't explain why is it.. i have this script: sub test() WHILE UO.Life > 0 poison = UO.Poisoned() IF poison == 1 UO.Cast('Cure','self) ELSE wait(5000) ENDIF WEND end sub In the case of poison different from 1( wait(5000) it doesn't matter if i set 100, 200 or 10000), my client go slowly.. as lag.. if i'm poisoned i go perfectly if i change in this i move perfectly always: sub test() WHILE UO.Life > 0 poison = UO.Poisoned() IF poison == 1 UO.Cast('Cure','self) ENDIF wait(5000) WEND end sub |
|
| Author: | Yoko [ 2004-06-28 14:48:29 ] |
| Post subject: | |
this is a very very often happends logics mistake note then script Code: while ... is equivalent to Code: while ... Empty cylce will consume all CPU. for any script you think may produce empty cycle it is safe and reliable to add wait(50) command before second operator bracket (wend, next, until, goto) for instance your script may look like: Code: sub test() |
|
| Author: | clagio [ 2004-06-28 18:38:48 ] |
| Post subject: | |
IF poison == 1 UO.Cast('Cure','self) ELSE wait(5000) ENDIF i never had the empty cycle..if im'not poisoned, it should go to the ELSE (wait 5000), no? |
|
| Author: | Yoko [ 2004-06-28 20:02:07 ] |
| Post subject: | |
IF you poisoned, where is delay? no delay ~= empty cycle |
|
| Author: | Yoko [ 2004-06-28 20:04:02 ] |
| Post subject: | |
even more, i just noticed, you flooding server with casts using such script you wrote, cause many many times per second, without delay you trying to cast Cure when you are poisoned |
|
| Author: | clagio [ 2004-06-28 20:18:52 ] |
| Post subject: | |
sorry i can't explain very well i go slowly only when i'm not poisoned this is strange for me.. cause i use a big delay(5000), but it doesn't matter what delay i use |
|
| Author: | voyta [ 2004-07-22 10:36:18 ] |
| Post subject: | |
If you are uncertain whhat happens in your script, do some debug messages... it'll show ya the problem. Code: sub test() btw: what the heck is IF without THEN ? Parser should Yell about it! btw2: what is "poison=" ment to be, when there is no "var poison" before? HA :) btw3: it is ABSOLUTELY useless, you can write "IF UO.Poisoned() THEN" instead |
|
| Page 1 of 1 | All times are UTC+02:00 |
| Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |
|