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.
 Entire forum ➜ MUSHclient ➜ General ➜ zMud to MUSHclient Script Conversion

zMud to MUSHclient Script Conversion

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


Pages: 1 2  

Posted by Kerowyn   USA  (3 posts)  Bio
Date Wed 29 Aug 2007 07:43 PM (UTC)
Message
Hello, I'm Kerowyn, a leader of a clan (Disciples of Hasson) on Aardwolf.

Many of my clan members use MUSHclient. I have used zMud for years, so don't have much knowledge of it. I may download it and install it on my Linux workstation (Kubuntu with Wine) to become more knowledgeable.

Anyway, I am also the webmaster for our clan and run an eGroupWare site with a knowledgebase. I post handy zMud scripts within it (among other things) and of course the first thing that the MUSHclient users want is for me to convert the zMud script to MUSHclient.

I'm no programmer (as I've said many, many times). I can read through most code and I understand the logic and can usually figure out the syntax (with help from online resources of course), but my time is limited.

So, is there any "easy" way for me to convert zMud scripts to one of the four(4) MUSHclient scripting languages?

If you want an example, I can post a simple/short script I have for automatically donating gold to the clan coffers when you level or successfully finish a quest.

Thanks in advance for any advice you can give me!


Thanks,

Kerowyn
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #1 on Wed 29 Aug 2007 09:26 PM (UTC)
Message
First off: MUSHclient supports 8 languages, and you don't need any of them for the triggers you mentioned. Well, depending on how complicated the level one is.

The easy one is the quest trigger. Copy everything from <triggers> to </triggers>, inclusive. Then open up the trigger menu with ctrl-shift-8 and click the paste button on the lower right corner.
<triggers>
  <trigger
   enabled="y"
   match=".* tells you 'As a reward, I am giving you \d+ quest points and (\d+) gold.'"
   regexp="y"
   sequence="100"
   send_to="1"
  >
  <send>clandonate %1</send>
  </trigger>
</triggers>

For the level trigger, it depends on what you want to do. You can donate a certain amount per level, for total levels, for you and your whole clan, per tier, whatever. To get at the basics of trigger making, take a look at the "Getting Started" section of the forums. If you just want the answer spit back like I gave for the quest gold donation, please explain a bit more exactly what you want donated on level.

I've been working on a plugin to convert zmud scripts to MUSHclient, but to be honest, I'm not familiar with zmud scripting at all. The scripting language of zmud is completely horrid. I'm somewhat dyslexic, so trying to read a 300 character line is just not going to happen.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #2 on Wed 29 Aug 2007 09:48 PM (UTC)
Message
I am Venificius on Aardwolf, and I can convert most zMud scripts to mushclient, and will do them in Lua, as it is the most cross-platform, and needs no other programs installed to use, due to its integration.

You can e-mail me the scripts and I will take a look at them, if you'd like. Onoitsu2@yahoo.com

And Shaun, as for dealing with a 300 character line, I too am dyslexic BUT I just break it down line by line, and add returns where a bracket opening starts, and after an end one, and attempt to make it one command/function per line.
Then I break down the triggers and aliases, and start my conversions from there.

Laterzzz,
Onoitsu2
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #3 on Wed 29 Aug 2007 10:00 PM (UTC)
Message
To be honest, it's not worth my time or effort to break down the zmud scripts. By the time I've sorted out the branches of ifs, figuring out that some things have 1-3 sets of brackets depending on what you are doing/declaring, I could have written something from scratch to do the same thing. I tried converting Bejito's moonbot script. I gave up and made my own script which worked much better than the mess I had made off of Bejito's script. I pretty much took a script that worked very well in one client and had turned it into a script which spat out random garbage in another client, in spite of trying to be extremely careful in breaking it down.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Kerowyn   USA  (3 posts)  Bio
Date Reply #4 on Thu 30 Aug 2007 12:02 AM (UTC)
Message
Thank you so much for such fast replies. Also thanks for the other to convert the script(s). I'm going to post the text from the donate script here because it's very short and I think somewhat simple.

#CLASS {donate}
#ALIAS settax {taxrate=%prompt( @taxrate, "Enter percentage to donate from 1-100");doncounttrue=%prompt( @doncounttrue, "Enter number of levels/pup before you donate");#IF (@doncount>@doncounttrue) {doncount=0}}
#VAR goldperlevel {9095}
#VAR taxrate {25}
#VAR doncount {0}
#VAR totdonate {0}
#VAR doncounttrue {1}
#VAR donateamount {47149}
#TRIGGER {^You receive (%d) gold} {#ADD goldperlevel %1}
#TRIGGER {^You get (%d) gold coins} {#ADD goldperlevel %1}
#TRIGGER {^You raise a level!!} {#ADD totdonate @goldperlevel;#ADD doncount 1;#MATH donateamount @totdonate*@taxrate/100;#IF (@doncount==@doncounttrue) {clandon @donateamount;doncount=0;totdonate=0};#IF (@doncounttrue=0) {doncount=0;totdonate=0};goldperlevel=0}
#TRIGGER {^Congratulations hero. You have increased your powers!} {#ADD totdonate @goldperlevel;#ADD doncount 1;#MATH donateamount @totdonate*@taxrate/100;#IF (@doncount==@doncounttrue) {clandon @donateamount;doncount=0;totdonate=0};#IF (@doncounttrue=0) {doncount=0;totdonate=0};goldperlevel=0}
#CLASS 0


Do you think I should look into using MUSHclient instead of zMud?

Can it do the multiple windows? I have a separate window for each chat/talk channel that automatically pops up when something new comes across.


Thanks,

Kerowyn
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #5 on Thu 30 Aug 2007 12:26 AM (UTC)
Message
I'll add the option to donate into my gains monitoring script.

Pretty much you just need two variables set. GetVariable( varname ) returns the value stored, and SetVariable( varname, value ) stores the value. Anything else can by modified depending on what language you are using.

for Lua:
^You receive (%d) gold
<triggers>
  <trigger
   enabled="y"
   match="^You receive (\d+) gold"
   regexp="y"
   sequence="100"
   send_to="12"
  >
  <send>SetVariable( "donateamount", GetVariable( "donateamount" ) + %1 )</send>
  </trigger>
</triggers>

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #6 on Thu 30 Aug 2007 12:37 AM (UTC)
Message
Multiple windows can be somewhat hard to manage for MUSHclient depending on what you are doing with them. I have a plugin on my webpage http://biggs.is-a-geek.net/~balaam which puts channel captures to a different window. I'm planning on getting it to split to user defined windows per channel at some point soon, but it's going to be hard to get them to pop up on command.

This is one of the reasons talk about designing a new client from the ground up have been discussed. I would love to have a window with its own tabs which can hold channel captures.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #7 on Thu 30 Aug 2007 03:29 AM (UTC)
Message
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, August 29, 2007, 9:22 PM -->
<!-- MuClient version 3.74 -->

<!-- Plugin "ClanLevelDonateLUA" generated by Plugin Wizard -->

<muclient>
<plugin
   name="ClanLevelDonateLUA"
   author="Onoitsu2"
   id="e6992b64478eb9a68d6182b9"
   language="Lua"
   purpose="Automatically Donates Gold To the Clan based upon % of gold earned per level/pup"
   save_state="y"
   date_written="2007-08-29 21:20:54"
   requires="3.74"
   version="1.0"
   >
</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   group="donate"
   ignore_case="y"
   match="^You (?:get|receive) (\d+) gold(\scoins)?"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("goldperlevel",tonumber(GetVariable("goldperlevel")) + tonumber("%1"))</send>
  </trigger>
  <trigger
   enabled="y"
   group="donate"
   ignore_case="y"
   match="^(You raise a level\!\!|Congratulations hero\. You have increased your powers\!)"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("totdonate",tonumber(GetVariable("totdonate")) + tonumber(GetVariable("goldperlevel")))
SetVariable("doncount",tonumber(GetVariable("doncount")) + 1)

SetVariable("donateamount",tonumber(GetVariable("totdonate") * tonumber(GetVariable("taxrate")) / 100)
if GetVariable("doncount") == GetVariable("doncounttrue") then
  Send("clandon " .. GetVariable("donateamount"))
  SetVariable("doncount",0)
  setVariable("totdonate",0)
elseif GetVariable("doncounttrue") == "0" then
  SetVariable("doncount",0)
  setVariable("totdonate",0)
  SetVariable("goldperlevel",0)
end -- if</send>
  </trigger>
</triggers>

<!--  Aliases  -->

<aliases>
  <alias
   match="^settax$"
   enabled="y"
   group="donate"
   omit_from_command_history="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>taxrate = tonumber(GetVariable("taxrate"))
doncounttrue = tonumber(GetVariable("doncounttrue"))
doncount = tonumber(GetVariable("doncount"))
if taxrate == nil then taxrate = 0 end
if doncounttrue == nil then doncounttrue = 1 end
if doncount == nil then doncount = 0 end

repeat
  taxrate = tonumber(utils.inputbox("Enter percentage to donate from 1-100","Please Enter Tax Rate To Donate At",taxrate))
  if taxrate == nil or taxrate &lt; 1 then
    if taxrate == nil then taxrate = "nil" end -- if
    utils.msgbox(taxrate .. " is an invalid percentage, please enter a number between 1-100.\nPlease enter another 

value...","Invalid Number Entered","ok","!") end -- if
until taxrate ~= nil and taxrate &gt; 0

repeat
  doncounttrue = tonumber(utils.inputbox("Enter the number of levels/pups before you donate","Please Enter Number Of 

Levels/Pups Till You Donate"))
  if doncounttrue == nil or doncounttrue &lt; 0 then
    if doncount == nil then doncounttrue == nil end -- if
    utils.msgbox(doncounttrue .. " is an invalid number of levels/pups.\nPlease enter a positive number","ok","!") end -- if
  elseif doncount &gt; doncounttrue then doncount = 0 end -- if
until doncounttrue ~= nil and doncounttrue &gt; -1

SetVariable("taxrate",taxrate)
SetVariable("doncounttrue",doncounttrue)
SetVariable("doncount",doncount)</send>
  </alias>
</aliases>
</muclient>


You can copy that ENTIRE section and paste it into notepad, or any other true text editor, and save it as a FILENAME.xml, and load that into mushclient and it will get the job done. I even added error checking for invalid inputs, just cause I am always cautious like that. And there are a few other ways to accomplish this task, rather than always saving and converting from mushclient variables and back and saving immediately, but since this might be part of a larger system I wanted it to work standalone, since I don't know the rest of the "script" to be.

Hope this helps :)

-Onoitsu2
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #8 on Thu 30 Aug 2007 04:58 AM (UTC)

Amended on Thu 30 Aug 2007 05:02 AM (UTC) by Shaun Biggs

Message
Here's a version of settax that won't let you enter 101% tax and will let you set the tax to 0 if you don't want to donate anything. It will also deny level entries of 2.31 and other non integers.
<aliases>
  <alias
   match="settax"
   enabled="y"
   group="donate"
   omit_from_command_history="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>taxrate = tonumber(GetVariable("taxrate")) or 0
doncounttrue = tonumber(GetVariable("doncounttrue")) or 1
doncount = tonumber(GetVariable("doncount")) or 0

taxrate = tonumber(utils.inputbox("Enter percentage to donate from 1-100","Please Enter Tax Rate To Donate At",taxrate))
while ( taxrate or -1 ) < 0 or taxrate > 100 do
  taxrate = tonumber(utils.inputbox(taxrate .. " is an invalid percentage, please enter a number between 0-100."))
end

doncounttrue = tonumber( utils.inputbox( 
      "Enter the number of levels/pups before you donate","Please Enter Number Of Levels/Pups Till You Donate"))
while ( doncounttrue or -1 ) > 0 or doncounttrue % 1 ~= 0 do
  doncounttrue = tonumber(utils.inputbox(doncounttrue .. " is an invalid number of levels/pups.  Please enter a positive integerer"))
end

SetVariable("taxrate",taxrate)
SetVariable("doncounttrue",doncounttrue)
SetVariable("doncount",doncount)</send>
  </alias>
</aliases>

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #9 on Thu 30 Aug 2007 05:05 AM (UTC)

Amended on Thu 30 Aug 2007 05:07 AM (UTC) by Shaun Biggs

Message
While I'm at it... here's how to prevent you from donating half a gold coin, or 0 gold if you set the tax to 0.
<send>SetVariable("totdonate",tonumber(GetVariable("totdonate")) + tonumber(GetVariable("goldperlevel")))
SetVariable("doncount",tonumber(GetVariable("doncount")) + 1)

SetVariable("donateamount",math.floor(tonumber(GetVariable("totdonate") * tonumber(GetVariable("taxrate")) / 100))
if GetVariable("doncount") == GetVariable("doncounttrue") then
  if GetVariable("donateamount") > 0 then
    Send("clandon " .. GetVariable("donateamount"))
  end
  SetVariable("doncount",0)
  setVariable("totdonate",0)
elseif GetVariable("doncounttrue") == "0" then
  SetVariable("doncount",0)
  setVariable("totdonate",0)
  SetVariable("goldperlevel",0)
end -- if</send>

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #10 on Thu 30 Aug 2007 05:20 AM (UTC)

Amended on Thu 30 Aug 2007 05:21 AM (UTC) by Shaun Biggs

Message
Hrm... Also, since Onoitsu wisely had the triggers capture only numbers, there is really no point in all of the tonumber() calls within the triggers' send field. Lua passes a nil value if the variable isn't a number, which will cause the same error if you don't follow it with an 'or 0' or some other error trapping number.

The other problem here is that this does not take into account gold autosplit with your group mates, so depending on if you are the more likely to get the last hit or not, the amount donated may be lower or higher than expected. Campaign and GQ gold is also skipped over... But they are easily captured in the same manor as the first trigger listed.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Kerowyn   USA  (3 posts)  Bio
Date Reply #11 on Thu 30 Aug 2007 11:26 AM (UTC)
Message
Wow! You two have really gone to town with this script. I very much appreciate it.

Since I have a four-day weekend coming up, I will have time to experiment with MUSHclient.

Do you know if it's all right to have MUSHclient and zMUD installed on the same computer? If so, then it will be easier to test.

Again, thanks for all your efforts.

Thanks,

Kerowyn
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #12 on Thu 30 Aug 2007 12:21 PM (UTC)
Message
It is perfectly safe to install both Mushclient and zMud on the same system, as safe as zMud itself is to install on a system. I say it this way, because I have had an older version of zMud, and its elicense scheme actually kill something in my windows system to where it would not boot any longer. Thankfully I was using a 2 drive method, and all progs and user files were on the 2nd drive, and windows itself was on its own section, so nothing was lost, but still pissed me off to no end.

-Onoitsu2
Top

Posted by Slarin   (1 post)  Bio
Date Reply #13 on Sat 01 Sep 2007 06:48 AM (UTC)

Amended on Sat 01 Sep 2007 06:52 AM (UTC) by Slarin

Message
What We really need is a room sw database. I know zmud has one somewhere.



is in Kerowyn's clan and a user of my bro Onoitsu2's scripts


Kerowyn and Onoitsu2 scripts will work on mushclient using wine on linux i should know i tested it for Onoitsu2 on my linux box and it work pretty well i must add :)
Top

Posted by Bottomfeeder   (42 posts)  Bio
Date Reply #14 on Sun 02 Sep 2007 11:42 PM (UTC)
Message
Ono, could I get you to troubleshoot an already converted plugin? It's a conglomeration of Ninja's and Atreidess' monitoring script. Problem is that it fires off about every 3 minutes automatically spamming results.

If you could either fix it to do the hourly report + on level report...or even just the on level/quest report I'd be forever grateful.

I'll shoot it to your email.
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.


69,965 views.

This is page 1, subject is 2 pages long: 1 2  [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.