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.
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.
<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 " & getvariable ("totalxp") & " xp in " & getvariable("minutes") & " minutes (" & getvariable("perhour") & " 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" & vbCRLF & "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.
<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 " & getvariable ("totalxp") & " xp in " & getvariable("minutes") & " minutes (" & getvariable("perhour") & " 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" & vbCRLF & "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.