Auto Looter

Post Reply
Oran
Posts: 2
Joined: Thu Apr 12, 2012 8:23 am

Auto Looter

Post by Oran »

I'm still grasping the basics of scripting and the like and I'm trying to make a auto looter that either
A) Picks up the corpse, command would be: "Take Corpse"
B) Or detects what it is I've just killed and inputs the name to loot that

Currently looks like this but it doesn't work:
temptimer( 3.01, [[send("take ..."))]])
As well as waiting for my balance to recover, which takes 3.01 seconds.
Any help would be greatly apprecitated, Thanks in advance

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Auto Looter

Post by Rakon »

All commands (functions) and otherwise within Mudlet are case sensitive.

Code: Select all

temptimer()
is NOT the same as

Code: Select all

tempTimer()
Notice the second capitalized 'T'. You need to use that format, for the tempTimer function.

Oran
Posts: 2
Joined: Thu Apr 12, 2012 8:23 am

Re: Auto Looter

Post by Oran »

Thanks, but now that it all works, the timer doesn't work, any idea's on why that is?

User avatar
Oneymus
Posts: 321
Joined: Thu Sep 17, 2009 5:24 am

Re: Auto Looter

Post by Oneymus »

I wouldn't rely on a timer for this. Instead, you should trigger on the balance/equilibrium message.

(Take the triggers as illustrative only. You'll need to make them work for you.)
Code: [show] | [select all] lua
-- Trigger: "You have killed (.+)."
-- If get_corpse exists, it will add 1 to it. If it doesn't, get_corpse gets set to 1.
get_corpse = (get_corpse + 1) or 1

-- Trigger: "You have regained balance."
-- If get_corpse exists, and there is at least 1 corpse to get, then get it.
if get_corpse and get_corpse > 0 then
  send("take corpse")
end

-- Trigger: "You pick up a corpse."
-- If get_corpse exists, and there is at least 1 corpse to get, we register
-- that we picked it up by decrementing get_corpse. If we still have corpses to get,
-- we send "take corpse" again.
if get_corpse and get_corpse > 0 then
  get_corpse = get_corpse - 1

  if get_corpse > 0 then
    send("take corpse")
  end
end
This was written completely in the forum editor, so I make no guarantees. But the idea behind it is sound, and could definitely be expanded upon.

Post Reply