LUA Problem

by Nezha

Back to Mechanic's Corner.

Nezha2007-12-18 03:24:32
Lua is giving me headaches.. it is not doing what is supposed to do.. or maybe its just too slow in doing it..
It is a really nice language with a very easy syntax, but sometimes.. i wished i would have done things in C or Pearl instead

QUOTE
With a focused look, Barendur strikes at you with a rising dawn morningstar. You grimace in pain as your ribs are crushed viciously.
2710h, 5199m, 4673e, 10p xkbp-
stand check -- It should do the stand check and ferret out stuns

With a heavy overhand stroke, Barendur slams a rising dawn morningstar down upon you. Your head snaps back as your skull is smited hard and fractures, causing your thoughts to spin.
2103h, 5199m, 4673e, 10p xkbp-
CrushedChest -- At this point i should have attempted to stand.. but didnt..

2103h, 5199m, 4673e, 10p xkbp-
You are too stunned to be able to do anything. -- -- As a result, still attempted to cure the affliction.
StunTrigger ..0


Im thinking that the sending of the actual command stand, is a little delayed or something.. and that the next command overlaps as a result, because the variables arent set yet..

Maybe this is not a lua problem anymore.. and that i need to code it in such a way that such network latency are taken into account.. crying.gif
Unknown2007-12-18 08:24:00
"A possible infinite loop at line 314 and a logic error in line 461 through 473", sayeth the magic crystal ball.

If you want help finding potential problems with your code - how about showing some code?
Faymar2007-12-18 09:40:52
Why not stop all curing when you get stunned and then start curing again after you get the unstun message or you detect that you aren't stunned from your stun check?
Unknown2007-12-19 02:11:10
Why would you attempt to stand without equilibrium?

It seems you don't echo your commands, either, so how do we know what caused the "You are too stunned..." message?
Nezha2007-12-19 02:50:22
Actually, i should have put this on the rants thread.. as i a just ranting tongue.gif

but to answer your questions..

The stand is not meant to be taken as i wanted to stand actually.. it only serves one important purpose
*Stun check* -- when you see the 'p' in the prompt can mean you are either prone or stunned.. so i try to stand to feret it out.. much more effective than putting all the stun lines as a trigger..
Unknown2007-12-19 19:39:26
Ah. I got ya now.

And, to answer your concerns about Lua's speed: it's actually pretty amazing on speed. As far as scripting languages for client applications go, Lua is the fastest I've seen to date. Native languages such as zScript or whatever TF uses are among the slowest. Languages that use the Windows Scripting Host engine aren't quite as fast as Lua, either, because of the extra layer required for integration. Lua itself is implemented in C, extensible with C libraries, and integrated directly with any application that uses it for extension through scripting.

In other words, maybe you've got a different issue with prompt triggering or it was just a natural game delay between you sending the command and seeing the result a bit later than expected. Again, without the echo of the command being sent, can you really tell?