Ok i've just started using mush. and my friend helped me with scripts for my game using vb. my question is. Is it possible to call a list of variables in a window form 100>2, while auto updating everytime i improve.
my trigger
* You think your parry skill has improved. *
you have recieved 100 improves in parry.
i'm hoping for something thats like
parry 100
control 99
something like that. it gets to be a hassle opening variable window when i want to check variables.
i have it set up at moment to do something like skill*
skill parry
parry 100.
Ok. after many hours of reading. i've found the miniwindow options. i can't seem to reposition it. so it takes up top right to lower right. i'm trying to get it to getVariablelist
and have it displayed in the window. but it keeps getting sent to output window. any suggestions on how to add the 2 together? i'm fine with it taking up right side. though i need to get rid of that light blue background.
Figured easier for me to keep track of one post.
I'm currently trying to work on a trigger timer.
* You think your %2 skill has improved. *
is the trigger. i have it set up to send to world. my script has it set up to display number of improves. i'm trying to make the timer work in conjunction with the trigger to display time since last.
5:00:00 pm
you think your brawling skill has improved.
brawling 100
5:00:02 pm
you think your parry skill has improved
parry 200
5:03:00 pm
you think your brawling skill has improved
brawling 101
time since last brawling improve 3 minutes.
5:04:00 pm
you think your parry skill has improved.
parry 201
time since last parry improve 3 minutes 58 seconds
i'm trying to make it universal so everytime i improve it goes back to the last time i improved that skill. so if ones sent to world and the other has to be sent to script how can i do this. open for ideas and thoughts.
my current setup bypasses my improve counter.
so while it displays the time difference it stop counting and displays no improve #. thats set in a trigger geting sent to script. i'm sure i did something backwards but not sure what. so i scrapped and am now starting at square one.
sub mytest(name,line,wildcards)
Dim myVar
Dim mySkill, skillFirst, skillLast
Dim twoWord
mySkill = wildcards(2)
twoWord = InStr(mySkill, "'")
if(twoWord > 0) then '
skillFirst = left ( mySkill, twoWord - 1 )
skillLast = right ( mySkill, len(mySkill) - twoWord)
mySkill = skillFirst & skillLast
end if
twoWord = InStr(mySkill, "-")
if(twoWord > 0) then '
skillFirst = left ( mySkill, twoWord - 1 )
skillLast = right ( mySkill, len(mySkill) - twoWord)
mySkill = skillFirst & skillLast
end if
twoWord = InStr(mySkill, "#")
if(twoWord > 0) then '
skillFirst = left ( mySkill, twoWord - 1 )
skillLast = right ( mySkill, len(mySkill) - twoWord)
mySkill = skillFirst & skillLast
end if
twoWord = InStr(mySkill, " ")
if(twoWord > 0) then '
skillFirst = left ( mySkill, twoWord - 1 )
skillLast = right ( mySkill, len(mySkill) - twoWord)
mySkill = skillFirst & "_" & skillLast
end if
myVar = getVariable(mySkill)
if isEmpty (myVar) then
note "Not Tracking this skill yet!!"
setVariable mySkill, 1
else
myVar = myVar + 1
setVariable mySkill, myVar
note " You have received " & myVar & " improvements in: " & mySkill
world.sound "ding.wav"
end if
end sub
sub save (name)
world.save ""
end sub
sub repeat_command (name, line, wildcards)
dim number
dim comm
dim preamb
dim post
if(InStr(line, "^")) then
number = mid(line, 2, InStr(line, " ")-1)
comm = right(line, len(line) - InStr(line, " "))
if(IsNumeric(number) = 0) then
note("Wrong syntax!!")
exit sub
end if
i=1
number = cint(number)
do while i <= number
preamb = left(comm, instr(comm,"^")-1)
if( len(preamb) < len(comm)-1 ) then
post = right(comm, len(comm)-instr(comm,"^"))
end if
send(preamb & i & post)
i = i+1
loop
else
number = mid(line, 2, InStr(line, " ")-1)
if(IsNumeric(number) = 0) then
note("Wrong syntax!!")
exit sub
end if
comm = right(line, len(line) - InStr(line, " "))
number = Cint(number)
do while number > 0
send(comm)
number = number - 1
loop
end if
end sub
is my script
barrowed from plugin's level_timer and adjusted for me.
<triggers>
<trigger
enabled="y"
match="^(> )?\* You think your ([a-z#_\' -]*) skill has improved\. \*"
regexp="y"
script="mytest"
send_to="12"
sequence="100"
>
<send>sub mytest (name, line, wildcards)
dim oldtime
dim newtime
dim days, hours, minutes
dim s1, s2, s3
dim msg
oldtime = GetVariable ("last_%2_improve_time")
'
' First time - just remember when we levelled
'
if IsEmpty (oldtime) or not IsDate (oldtime) then
SetVariable "last_%2_improve_time", now
Note "Level time noted."
exit sub
end if
'
' Find total minutes it took to improve
'
minutes = DateDiff ("n", CDate (oldtime), Now)
'
' Add "s" if plural
'
s1 = "s"
s2 = "s"
s3 = "s"
if days = 1 then s1 = ""
if hours = 1 then s2 = ""
if minutes = 1 then s3 = ""
'
' Make message
'
msg = "Time to level = " _
& days & " day" & s1 & ", " _
& hours & " hour" & s2 & ", " _
& minutes & " minute" & s3 & "."
ColourNote "white", "blue", msg
SetVariable "last_%2_improve_time", now
end sub
</send>
</trigger>
</triggers>
if i disable timer and reload script my counter works. with timer enabled it quits counting or displaying # of improves.
ok. fine tuning the timer to get exactly what i want but have the basics down.
next project. i'm not having much luck with the windows so i'm using note pad for now till i have it completly worked out. i'd like to have a timer every 30 seconds AppendToNotepad GetVariable list. but i'm not sure the easiest way to go about it.
would it be easier to put in script then have the timer call from script and append results to notepad?
Try this. To execute a script inside a timer (like GetVariableList) you have to "send to script". Inside the script you can decide to output to a notepad window.
<timers>
<timer name="skill_list"
enabled="y"
second="30.00"
send_to="12"
>
<send>
dim varList
ReplaceNotepad "my_variables", ""
varList = GetVariableList
If Not IsEmpty (varList) Then
For Each v In varList
AppendToNotepad "my_variables", v & " = " & GetVariable (v) & VbCrLf
Next
End If
</send>
</timer>
</timers>
is there a way to sort the list. either numerically or alphabetically? it just appears any old fashion or at least not in a way that makes sense to me.
oh is there a reason when i open variables and sort by the value it has 2 as being greater then 1700?
There probably is a way under VB to sort them, offhand I don't know it. Under Lua it would be easy. :)
The variables in the variable list are stored as strings, and thus "2" is greater than "1700".
If you install the plugin below, written in Lua, it will show your world variables, in alphabetic order:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, March 20, 2009, 8:12 AM -->
<!-- MuClient version 4.40 -->
<!-- Plugin "Show_Variables" generated by Plugin Wizard -->
<muclient>
<plugin
name="Show_Variables"
author="Nick Gammon"
id="dffeb3db157e34ab0999a933"
language="Lua"
purpose="Shows world variables in alphabetic order in the main window"
date_written="2009-03-20 08:11:14"
requires="4.00"
version="1.0"
>
<description trim="y">
<![CDATA[
Shows all world variables, in a notepad window, in alphabetic order.
]]>
</description>
</plugin>
<!-- Timers -->
<timers>
<timer
enabled="y"
second="30.00"
send_to="12"
>
<send>
ReplaceNotepad ("World Variables", "")
varList = GetPluginVariableList ("") -- get global variables
require "pairsbykeys"
if varList then
for k, v in pairsByKeys (varList) do
AppendToNotepad ("World Variables", k .. " = " .. v .. "\r\n")
end -- for
end -- if
</send>
</timer>
</timers>
</muclient>
^(.*?) You think that Uxmal\'s (.*?) skill has improved\. (.*?)$
I have multiple pets in Dartmud, and we can track them like our own. is there a way to piggy back pets off my script or do i need to redo one strictly for pets.
maybe adjust trigger to uxmal|scrap|new pets
but adjust variable to match each pets. then through in a plugin to save on spam from pet_variables.
Something like Uxmal_fighting 30
easier to stick to one topic since it has script already.