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)
'
' Convert to days, hours, minutes
'
days = Fix (minutes / 1440)
minutes = minutes - (days * 1440) ' remainder
hours = Fix (minutes / 60)
minutes = minutes - (hours * 60) ' remainder
'
' 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. |