Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ [?] No-Hands Killing Script

[?] No-Hands Killing Script

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  3  

Posted by Amoeba   (16 posts)  Bio
Date Sun 20 Feb 2005 10:43 AM (UTC)
Message
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.

-- 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_alias


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
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #1 on Mon 21 Feb 2005 08:35 AM (UTC)

Amended on Mon 21 Feb 2005 08:38 AM (UTC) by David Berthiaume

Message
This is an easy one. But, what scripting language do you want to use? (As a beginner, I would reccomend VBscript, mostly because thats what I learned on, and I'm still learning Lua)

I could have it written for you in... Lemme see here, 5 minutes, once you know what language you want to use.

It's very similar to the huntscript I wrote.
Top

Posted by Amoeba   (16 posts)  Bio
Date Reply #2 on Mon 21 Feb 2005 08:38 AM (UTC)
Message
LUA is what I'm best with.

Thanks very much for the reply!
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #3 on Mon 21 Feb 2005 08:39 AM (UTC)
Message
Ok, well... That's going to be a little more tricky, let me get back to you in a few minutes... I should have most of it hashed out.
Top

Posted by Amoeba   (16 posts)  Bio
Date Reply #4 on Mon 21 Feb 2005 08:41 AM (UTC)
Message
You're doing *me* a favor. Choose what you like. Heck, write it in psuedo-code :P

Thanks so much.
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #5 on Mon 21 Feb 2005 08:46 AM (UTC)

Amended on Mon 21 Feb 2005 08:49 AM (UTC) by David Berthiaume

Message
Whats the output when you rest, and when you stand up?

Top

Posted by Amoeba   (16 posts)  Bio
Date Reply #6 on Mon 21 Feb 2005 08:47 AM (UTC)
Message
Doh! Sorry

You clamber to your feet.
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #7 on Mon 21 Feb 2005 08:50 AM (UTC)
Message
Timing isn't nearly as difficult as you think it is. So don't worry about that.
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #8 on Mon 21 Feb 2005 08:53 AM (UTC)
Message
I need to know EXACTLY what your prompt looks like.
Top

Posted by Amoeba   (16 posts)  Bio
Date Reply #9 on Mon 21 Feb 2005 08:55 AM (UTC)
Message
I'll paste in a sequence. Give me 5.

Thanks so much.
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #10 on Mon 21 Feb 2005 09:02 AM (UTC)
Message
The only thing I need now, is the Prompt, the exact prompt.

Also, I'm not to sure on how to do one thing...


if <wildcard 1> = <wildcard 2, AND Wild Card 3 = wildcard 4 Then
Blah, blah, blah
Else
Blah, Blah, Blah...
end
Top

Posted by Amoeba   (16 posts)  Bio
Date Reply #11 on Mon 21 Feb 2005 09:04 AM (UTC)
Message
Oh, it's just ">"

Is that what you're asking?
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #12 on Mon 21 Feb 2005 09:04 AM (UTC)
Message
That's the only part I don't know. Is the last part, making sure both Fat, and Health are at 100%, I can do either or... I don't know how to do both at the same time.

Somewhere in there, there has to be a way to join the two together...
Top

Posted by David Berthiaume   (202 posts)  Bio
Date Reply #13 on Mon 21 Feb 2005 09:08 AM (UTC)
Message
Never mind, I figured it out. I need to know your EXACT prompt.
Top

Posted by Amoeba   (16 posts)  Bio
Date Reply #14 on Mon 21 Feb 2005 09:08 AM (UTC)
Message
Well,

Can you say local health, fatigue = {regex string here}
then
if ( ( health = xxx ) and ( fatigue = xxx ) ) then
--stuff
else
--other
end
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


76,535 views.

This is page 1, subject is 3 pages long: 1 2  3  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.