[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Could someone help me with this
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Could someone help me with this

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


Posted by Trpstrife   (3 posts)  [Biography] bio
Date Mon 24 Oct 2005 06:07 PM (UTC)

Amended on Mon 24 Oct 2005 06:08 PM (UTC) by Trpstrife

Message
I'm trying to convert a script for zmud to mush for a friend of mine but so far I havn't been able to make heads or tails out of the mush clients scripting. the code is as follows

#CLASS {xptimer}
#ALIAS showxp {showxp=1;cost}
#ALIAS startxp {savexp=1;cost}
#VAR minutes {11}
#VAR offsetxp {47361000}
#VAR savexp {0}
#VAR showxp {0}
#VAR totalxp {3712000}
#ALARM "mintimer" {-1:00} {#math minutes (@minutes+1)}
#REGEX {You have ((.+)) to spend on stats, skills or to use to level\.} {#if (@showxp=1) {#math totalxp (%1-@offsetxp);#math perminute (@totalxp/@minutes);#math perhour (@perminute*60);pl You have made @totalxp xp in @minutes minutes (@perhour xp per hour);showxp=0};#if (@savexp=1) {savexp=0;minutes=0;offsetxp=%1;#alarm "mintimer" -1:00 {#math minutes (@minutes+1)};#say XP Timer started}}
#CLASS 0

If anyone can help me with this Id be very grateful.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 24 Oct 2005 08:12 PM (UTC)
Message
To get you started, there is a post which shows various zMUD things converted to MUSHclient scripts:


http://www.gammon.com.au/forum/?bbsubject_id=3032


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Trpstrife   (3 posts)  [Biography] bio
Date Reply #2 on Tue 25 Oct 2005 04:13 PM (UTC)

Amended on Tue 25 Oct 2005 04:31 PM (UTC) by Trpstrife

Message
Going by the information on the other page this is what I've got so far.

ALIAS
match="showxp *"
enabled="y"
send_to"12"
sequence="100"
EnableTriggerGroup "xptimer", vbTrue
SetVariable "showxp", "1,cost"
send
alias

ALIAS
match="startxp *"
enabled="y"
send_to"12"
sequence="100"
EnableTriggerGroup "xptimer", vbTrue
SetVariable "savexp", "1,cost"
send
alias

SetVariable "minutes"

SetVariable "offsetxp"

SetVariable "savexp", "0"

SetVariable "showxp", "0"

SetVariable "totalxp"
--------------------------------------------------------
From here down im completely lost

#ALARM "mintimer" {-1:00} {#math minutes (@minutes+1)}
#REGEX {You have ((.+)) to spend on stats, skills or to use to level\.} {#if (@showxp=1) {#math totalxp (%1-@offsetxp);#math perminute (@totalxp/@minutes);#math perhour (@perminute*60);pl You have made @totalxp xp in @minutes minutes (@perhour xp per hour);showxp=0};#if (@savexp=1) {savexp=0;minutes=0;offsetxp=%1;#alarm "mintimer" -1:00 {#math minutes (@minutes+1)};#say XP Timer started}}
#CLASS 0

If someone could give me a hand and maybe check what I got done id be very appreciative.
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #3 on Tue 25 Oct 2005 06:06 PM (UTC)
Message
Hmm.

<timers>
  <timer enabled="y"
   minute="1"
   send_to="12"
   one_shot="y"
   name="mintimer"
  >
  <send>setvariable "minutes", getvariable ("minutes") + 1</send>
  </timer>
</timers>

<triggers>
  <trigger
   enabled="y"
   match="You have ((.+)) to spend on stats, skills or to use to level\."
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if getvariable("showxp") = 1 then
  setvariable "totalxp", %1 - getvariable("offsetxp")
  setvariable "perminute", getvariable ("totalxp") / getvariable ("minutes")
  setvariable "perhour" , getvariable ("perminute") * 60
  send "pl You have made " &amp; getvariable ("totalxp") &amp; " xp in " &amp; getvariable("minutes") &amp; " minutes (" &amp; getvariable("perhour") &amp; " xp per hour"
  setvariable "showxp",0
end if
if getvariable("savexp") = 1 then
  setvariable "savexp", 0
  setvariable "minutes", 0
  setvariable "offsetxp", %1
  addtimer "mintimer",0,1,0,"setvariable "minutes", getvariable("minutes")+1" &amp; vbCRLF &amp; "note XP Timer started",1029,""
  settimeroption "mintimer", "send_to", 12
end if</send>
  </trigger>
</triggers>


Though.. I don't swear to this working right... Its my best guess and entirely untested.

BTW Nick. Seems the XML generation for timers is a bit odd and doesn't place all of the parts on seperate lines. The version I actually got of the timer above from 'copy' looked like this: Notice the extra line between </send> and </timer> as well as all the options crammed together on the <timer line.

<timers>
  <timer name="mintimer" enabled="y" minute="1"    send_to="12"
one_shot="y" >
  <send>setvariable "minutes", getvariable ("minutes") + 1</send>

  </timer>
</timers>
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Tue 25 Oct 2005 10:24 PM (UTC)
Message
Quote:

Seems the XML generation for timers is a bit odd and doesn't place all of the parts on seperate lines


That was intentional, the stuff about hours, mins, secs took up heaps of lines, so to save space, they are written on the one line.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Trpstrife   (3 posts)  [Biography] bio
Date Reply #5 on Wed 26 Oct 2005 12:25 AM (UTC)
Message
I'm not quite sure whats wrong with this. It won't import. It says its not in xml format.

<alias
match="showxp *"
enabled="y"
send_to"12"
sequence="100"
>
EnableTriggerGroup "xptimer", vbTrue
SetVariable "showxp", "1,cost"
</send>
</alias>

<alias
match="startxp *"
enabled="y"
send_to"12"
sequence="100"
>
EnableTriggerGroup "xptimer", vbTrue
SetVariable "savexp", "1,cost"
</send>
</alias>

<timers>
<timer enabled="y"
minute="1"
send_to="12"
one_shot="y"
name="mintimer"
>
<send>setvariable "minutes", getvariable ("minutes") + 1</send>
</timer>
</timers>

<triggers>
<trigger
enabled="y"
match="You have ((.+)) to spend on stats, skills or to use to level\."
regexp="y"
send_to="12"
sequence="100"
>
<send>if getvariable("showxp") = 1 then
setvariable "totalxp", %1 - getvariable("offsetxp")
setvariable "perminute", getvariable ("totalxp") / getvariable ("minutes")
setvariable "perhour" , getvariable ("perminute") * 60
send "pl You have made " &amp; getvariable ("totalxp") &amp; " xp in " &amp; getvariable("minutes") &amp; " minutes (" &amp; getvariable("perhour") &amp; " xp per hour"
setvariable "showxp",0
end if
if getvariable("savexp") = 1 then
setvariable "savexp", 0
setvariable "minutes", 0
setvariable "offsetxp", %1
addtimer "mintimer",0,1,0,"setvariable "minutes", getvariable("minutes")+1" &amp; vbCRLF &amp; "note XP Timer started",1029,""
settimeroption "mintimer", "send_to", 12
end if</send>
</trigger>
</triggers>

I feel like with your help I'm getting closer. It's probably just a syntax problem I'm over looking.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Wed 26 Oct 2005 01:29 AM (UTC)
Message
Around the aliases you need:

<aliases>

...

</aliases>


This is similar to what you had for triggers. Copy a single alias the clipboard from the alias list and you will see what I mean.

You shouldn't need to manually type in your aliases in XML anyway, just use the GUI editor to insert them.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


5,201 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]