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 ➜ auto split

auto split

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


Posted by Brett McLennan   (9 posts)  Bio
Date Tue 03 Dec 2002 01:43 PM (UTC)
Message
How can I set up an auto split trigger that skims a percentage of my choosing to work.

i type something like autosplit to turn it on and something like skim 10 to split all but 10%

the trigger would be

mud sends - A death cry echoes from somewhere

Client sends - get coins corpse

mud sends - You get 100 coins from the corpse.

Client sends - split 90 coins


...i know its not ethical, but I play a very evil thief, who's always looking for trouble.

Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #1 on Tue 03 Dec 2002 07:26 PM (UTC)
Message
Try this: ;)
<aliases>
  <alias
   name="Split_Set"
   script="Split_Set"
   match="autosplit %1"
   enabled="y"
  >
  </alias>
</aliases>

<triggers>
  <trigger
    name="Split_It"
    script="Split_It"
    match="^You get (/d+) coins from the corpse\."
    regexp="y"
    enabled="y"
  >
  </trigger>
  <trigger
    match="^A death cry echoes from somewhere"
    regexp="y"
    enabled="y"
  >
  <send>get coins corpse</send>
  </trigger>
</triggers>

In your script file>

sub Split_It(tname, output, wilds)
  dim temp, perc
  perc = world.getvariable("split_perc")
  temp = Cint((wilds(1) * perc) / 100)
  world.send "split " & temp & " coins"
end sub

sub Split_Set(aname, output, wilds)
  if int(wilds(1)) >= 0 and int(wilds(1)) <= 100 then
    world.setvariable "split_perc",wilds(1)
    world.note "Split set to " & wilds(1) & "%."
  else
    world.colournote "red","black","Must be a number and between 0-100."
  end if
end sub
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 05 Dec 2002 02:56 AM (UTC)
Message
The match line should use a backslash for \d, to match on digits, like this:



 match="^You get (\d+) coins from the corpse\."

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


12,933 views.

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.