Note: Wizards of the MUD have said this is okay
I'm new to the mudding world and especially MUSHclient. With the help of a forum post on coding a delay functionality into my scripts I have written a script that will summon an enemy, kill it, get loot, cleanup, rest and repeat.
This works but it isn't all that great..
-It requires I find out what appropriate times are
-It only works for one situation (see above complaint)
-It could kill a lot faster if I coded it better
-More complaints, but anyways
Here's What I Want
I will manually start the script once I'm in an appropriate room.
-Summon enemy (Send "challenge")
-Text "The Intermediate calmly steps onto the mat." will be displayed
-Once enemy is summoned, kill enemy (Send "kill student")
-When I'm finished killing the enemy (String: "You killed Intermediate!")
--Loot corpse (Command: "get all from corpse")
--Cleanup the room (Command: "cleanup")
-Rest ("Command: "rest")
-When HP/Fatigue are at 100% again (String: "HP: xxxx/xxxx Mana: xxxx/xxxx Fatigue: xxxx/xxxx Exp: xxxxxxxxx")
--Stand up (Command: "stand")
-- Loop script from here
I have been looking through all that MUSHclient can do and thought I'd post here before I spend major amounts of time. Does anyone have parts of this (or the whole thing) already written out?
Thank,
Amoeba
I'm new to the mudding world and especially MUSHclient. With the help of a forum post on coding a delay functionality into my scripts I have written a script that will summon an enemy, kill it, get loot, cleanup, rest and repeat.
-- table of outstanding threads that are waiting
wait_table = {}
-- called by a timer to resume a thread
function wait_timer_resume (name)
thread = wait_table [name]
if thread then
assert (coroutine.resume (thread))
end -- if
end -- function wait_timer_resume
-- we call this to wait in a script
function wait (thread, seconds)
id = "wait_timer_" .. GetUniqueNumber ()
hours = math.floor (seconds / 3600)
seconds = seconds - (hours * 3600)
minutes = math.floor (seconds / 60)
seconds = seconds - (minutes * 60)
status = AddTimer (id, hours, minutes, seconds, "",
timer_flag.Enabled + timer_flag.OneShot +
timer_flag.Temporary + timer_flag.Replace,
"wait_timer_resume")
assert (status == error_code.eOK, error_desc [status])
wait_table [id] = thread
coroutine.yield ()
end -- function wait
function my_alias_thread (thread, name, line, wildcards)
Send ("stand")
wait (thread, 10)
Send ("challenge")
wait (thread, 10)
Send ("kill student")
wait (thread, 60)
Send ("get all from corpse")
wait (thread, 10)
Send ("get coins")
wait (thread, 10)
Send ("cleanup")
wait (thread, 10)
Send ("hp")
wait (thread, 1)
Send ("rest")
wait (thread, 90)
end -- function my_alias_thread
function my_alias (name, line, wildcards)
thread = coroutine.create (my_alias_thread)
assert (coroutine.resume (thread, thread, name, line, wildcards))
end -- function my_aliasThis works but it isn't all that great..
-It requires I find out what appropriate times are
-It only works for one situation (see above complaint)
-It could kill a lot faster if I coded it better
-More complaints, but anyways
Here's What I Want
I will manually start the script once I'm in an appropriate room.
-Summon enemy (Send "challenge")
-Text "The Intermediate calmly steps onto the mat." will be displayed
-Once enemy is summoned, kill enemy (Send "kill student")
-When I'm finished killing the enemy (String: "You killed Intermediate!")
--Loot corpse (Command: "get all from corpse")
--Cleanup the room (Command: "cleanup")
-Rest ("Command: "rest")
-When HP/Fatigue are at 100% again (String: "HP: xxxx/xxxx Mana: xxxx/xxxx Fatigue: xxxx/xxxx Exp: xxxxxxxxx")
--Stand up (Command: "stand")
-- Loop script from here
I have been looking through all that MUSHclient can do and thought I'd post here before I spend major amounts of time. Does anyone have parts of this (or the whole thing) already written out?
Thank,
Amoeba