Just create the following script and timer:
If I call GetStatus directly from the command line like /GetStatus, it works and correctly sends the info retrieved from the HTML of that page. However when relying on the timer it went 30 minutes (when the timer was in fact enabled) without ever doing anything. If I ' out the sends and un-rem the world.note ubound(temp) line, as I did to try to run a test with a shorter time, then saved it, it suddenly fired.
Put simply these where the results:
Attempt 1>
Tried: Timer at 20 minutes world.notes a warning that the client will lag from the load and activates a 5 second timer to call the sub.
Result: Sub keeps repeating world.note "Retrieving... Standby" line, assumption is that the temporary 5 second timer is continually firing, instead of firing once.
Attempt 2>
Tried: Change stuff around to use one timer, add a reset to the start in case it also tries to fire over and over.
Result: Time out error, assumed from changing inet.RequestTimeOut = 20 to 10 instead.
Attempt 3>
Tried: Changed TimeOut back to 20, added on error goto next to routine before call to get the HTML.
Result: Trigger never seems to fire.
Attempt 4>
Tried: Adding on error goto 0, in case something later is causing it.
Result: Same as #3.
Something about this code doesn't want to work right with timers and I can't figure out what or why. :p But it does work when called directly. Not sure about triggers or aliases though.
<timers>
<timer name="TGetStatus" script="TGetStatus" minute="20" >
</timer>
</timers>
sub GetStatus
call TGetStatus("Ghost")
end sub
sub TGetStatus (Tname)
world.resettimer "TGetStatus"
dim inet
set inet = createobject("InetCtls.Inet")
inet.Url = "http://www.topmudsites.com/index2.shtml"
inet.RequestTimeOut = 20
dim e, f, st, en, test
world.note "Retrieving... Standby"
on error resume next
e = inet.OpenUrl()
on error goto 0
dim RegEx, Match, Matches
set RegEx = New RegExp
RegEx.Pattern = "<.*Ages.*>"
set Matches = RegEx.Execute(e)
for each Match in Matches
'world.note Match.FirstIndex
test = "<tr bgcolor=#e1e1fc>"
st = instrrev(e,test,int(Match.FirstIndex))
test = "</tr>"
en = instr(int(Match.FirstIndex),e,test)
f = mid(e, st, en - st + 5)
dim temp
temp = split(f,chr(10))
'world.note ubound(temp)
st = instr(temp(1),"<b>")
en = instr(temp(1),"</b>")
dim rank, votes
rank = mid(temp(1),st + 3,en - (st + 3))
st = instr(temp(6),"size=2>")
en = instr(temp(6),"</font>")
votes = mid(temp(6), st + 7, en - (st + 7))
world.send "to gossip"
world.send "Our current ranking is " & rank & " with " & votes & " votes. Vote AoD!"
world.send "www.topmudsites.com/cgi-bin/topmuds/"
world.send " rankem.cgi?action=in&id=aod"
world.send "."
'world.note f
'world.note Match.Value
next
end subIf I call GetStatus directly from the command line like /GetStatus, it works and correctly sends the info retrieved from the HTML of that page. However when relying on the timer it went 30 minutes (when the timer was in fact enabled) without ever doing anything. If I ' out the sends and un-rem the world.note ubound(temp) line, as I did to try to run a test with a shorter time, then saved it, it suddenly fired.
Put simply these where the results:
Attempt 1>
Tried: Timer at 20 minutes world.notes a warning that the client will lag from the load and activates a 5 second timer to call the sub.
Result: Sub keeps repeating world.note "Retrieving... Standby" line, assumption is that the temporary 5 second timer is continually firing, instead of firing once.
Attempt 2>
Tried: Change stuff around to use one timer, add a reset to the start in case it also tries to fire over and over.
Result: Time out error, assumed from changing inet.RequestTimeOut = 20 to 10 instead.
Attempt 3>
Tried: Changed TimeOut back to 20, added on error goto next to routine before call to get the HTML.
Result: Trigger never seems to fire.
Attempt 4>
Tried: Adding on error goto 0, in case something later is causing it.
Result: Same as #3.
Something about this code doesn't want to work right with timers and I can't figure out what or why. :p But it does work when called directly. Not sure about triggers or aliases though.