Hello everyone!
I've been playing MUDs since 2003 and always used MushClient to do so, quite a long time I think.
Nevertheless - and since I am not the best when it comes to programming - it wasn't until recent years that I found out (shame to myself) about the very nice implemented timers and triggers functions (I only used aliases so far).
Times change and so do MUDs. When it was uncomfortable to use scripts in the past, lots of players in my MUD nowaydays do so for leveling. This brought me up with the idea trying to figure it out myself - creating new characters and new classes without months/years of manually killing the same creatures over and over again.
I searched this forum for weeks now, read the introduction to Lua, but still I am not quite sure how to fix certain problems that I have to struggle with.
I found this entry very helpful:
http://www.mushclient.com/forum/?id=8613&reply=8
Based on that I tried to write a timer for myself (since the Lua-Add-Timer-function just caused errors for me).
Here is what I came up with:
I want to cast my protection spells(shields and so on), then run a certain path (that loops) in the wild (no exists visible - just a map) and stop when I meet the desired creature to kill. After doing so continuing on my pre-defined path. If my shield, armor or weapon fails to work, I want to go some steps back, search a secure spot in the wilderness (none or harmless creatures on the field) and then cast my shield, repair armor, eat something etc. After that continuing.
To do so I added some Variables(?) that make something true or false and wrote down the path. It looks like this:
The variables are:
forward = true
You killed *
Your shield is ready.
forward = false
Your shield collapses.
A horrible creature. -- also triggers attack
backward = true
Your shield collapses.
Your axe broke. -- your armor broke etc
backward = false
Your shield is ready.
peaceful = false
A horrible creature. -- and some other creatures
I tried several things, but all of them didn't work out.
I also have the feeling that the timer somehow misinterprets my desired path. Sometimes I run straight forward to the south or somewhere else (although I always reset the timers before I tried it out again). Even when I do not add any further code, just the path.
I guess these are just minor problems and I hope someone can help me understand what I did wrong. I appreciate that you read so far and have a nice day! :)
I've been playing MUDs since 2003 and always used MushClient to do so, quite a long time I think.
Nevertheless - and since I am not the best when it comes to programming - it wasn't until recent years that I found out (shame to myself) about the very nice implemented timers and triggers functions (I only used aliases so far).
Times change and so do MUDs. When it was uncomfortable to use scripts in the past, lots of players in my MUD nowaydays do so for leveling. This brought me up with the idea trying to figure it out myself - creating new characters and new classes without months/years of manually killing the same creatures over and over again.
I searched this forum for weeks now, read the introduction to Lua, but still I am not quite sure how to fix certain problems that I have to struggle with.
I found this entry very helpful:
http://www.mushclient.com/forum/?id=8613&reply=8
Based on that I tried to write a timer for myself (since the Lua-Add-Timer-function just caused errors for me).
Here is what I came up with:
I want to cast my protection spells(shields and so on), then run a certain path (that loops) in the wild (no exists visible - just a map) and stop when I meet the desired creature to kill. After doing so continuing on my pre-defined path. If my shield, armor or weapon fails to work, I want to go some steps back, search a secure spot in the wilderness (none or harmless creatures on the field) and then cast my shield, repair armor, eat something etc. After that continuing.
To do so I added some Variables(?) that make something true or false and wrote down the path. It looks like this:
route = {
"e", "e", "e", "e", "e", "e", "e", "e", "se", "w", "w", "w", "w", "w", "w", "w", "w", "w", --very long continuing of the path
}
forward = true
backwards = false
peaceful = false
if forward == true or backwards == false then
loc = (loc or 0) + 1 -- maybe put it somewhere else
return
elseif loc > #route then
loc = 1
elseif backward == true then
loc = (loc or 0) - 1 -- I guess this is not correct
elseif peaceful ~= false then -- this too
Send "heal"
Send "cast shield"
end
Send (route [loc])
The variables are:
forward = true
You killed *
Your shield is ready.
forward = false
Your shield collapses.
A horrible creature. -- also triggers attack
backward = true
Your shield collapses.
Your axe broke. -- your armor broke etc
backward = false
Your shield is ready.
peaceful = false
A horrible creature. -- and some other creatures
I tried several things, but all of them didn't work out.
I also have the feeling that the timer somehow misinterprets my desired path. Sometimes I run straight forward to the south or somewhere else (although I always reset the timers before I tried it out again). Even when I do not add any further code, just the path.
I guess these are just minor problems and I hope someone can help me understand what I did wrong. I appreciate that you read so far and have a nice day! :)