Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts Goto page 1, 2, 3  Next
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Fri Sep 01, 2006 11:56 pm   

TMC Mud List Rankings
 
TMC Top 20 Mud List Rankings Razz

http://www.mudconnect.com/top20.html

A script to display, record, and tally TMC Top 20 MUD List Rankings.

Updated Sept 04 2006

Commands:

tmc

downloads TMC Top 20 Mud List Rankings and displays rankings within Zmud

records rankings (if not already recorded) to a text file in the Zmud.exe directory

tmc <m>

displays the mth rankings recorded

where m = 1 to Number of Rankings Recorded

tmc <m> <n>

displays the difference in votes between the mth rankings record and the nth rankings record

where m <= n
where m = 1 to Number of Rankings Recorded
where n = 1 to Number of Rankings Recorded

tmcz

displays the most recent rankings recorded

tmcxz

displays the difference in votes between the two most recent rankings records
(calculate how all the top 20 muds voted the day before)

tmcaz

displays the difference in votes between the least and the most recent rankings records
(calculate how all the top 20 muds voted for the week)

tmclist

displays a list of when the TMC server generated each rankings


Here is an example of the output from the tmc alias:

>tmc
Code:
TMC Top 20 Mud List Rankings

1. BatMUD (5234)
2. MUME - Multi Users In Middle Earth (5227)
3. SlothMUD III (4669)
4. Medievia (4169)
5. ZombieMUD (3756)
6. Federation II (3503)
7. Shadows of Isildur (2949)
8. Duris: Land of BloodLust (2717)
9. Mozart MUD (2636)
10. Armageddon (2607)
11. LegendMUD (2215)
12. Dreams (2061)
13. Evarayn (2052)
14. Genesis (1861)
15. Dark and Shattered Lands (1823)
16. Abandoned Realms (1808)
17. Wheel of Time (1786)
18. Legends of Karinth (1743)
19. Carrion Fields (1566)
20. Aardwolf (1423)

Rankings Last Generated: Fri Sep  1 12:00:08 2006



This script uses a VBScript .vbs file in the Zmud.exe directory.

This script uses wscript.exe, that should be in the %windir%\system32 directory, to run the .vbs file.

If VBScript is not an available scripting language on your computer, then you can download Microsoft Windows Script 5.6 here:

http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp

You have to check "Allow VBScript" in preferences/script parser within Zmud.


Arrow Zscript Code [written with zMUD version 7.21]:

Code:
#class {Vote_Scripts}
#var tmc_rankings {0} {0}
#var tmc_db_vote_1 {0} {0}
#var tmc_db_vote_2 {0} {0}
#var tmc_db_rank {0} {0}
#no
#trigger {^Opened tmc.zmud.txt as file %d} {#gag}
#trigger {^Closed tmc.zmud.txt on file %d} {#gag}
#no
#alias tmclist {
#file 1 tmc.zmud.txt
#show {}
#if (%filesize(1) = 0) {#show {Note: Record Empty}} {
#show {%ansi(6)TMC Top 20 Mud List Rankings}
#show {}
#loop 1,%filesize(1) {#show {%ansi(2)%i. %subregex(%read(1,%i), ".* Generated: (.*)~}", "%%%1")}}
#show {}
#show {%ansi(6)Record of Rankings Last Generated}}
#close 1}
#no
#alias tmc {
#if (%1 = %null) {#launch {wscript.exe tmc.zmud.vbs}} {
#file 1 tmc.zmud.txt
#show {}
#if (%2 = %null) {
#if ((%filesize(1) < %1) or (%1 < 1)) {#show {Note: Record Empty}} {
#show {%ansi(6)TMC Top 20 Mud List Rankings}
#show {}
#read 1 %1
#loop 1,20 {#show {%ansi(2)%item(@tmc_rankings,%i)}}
#show {}
#show {%ansi(6)%char(91)%1%char(93) %item(@tmc_rankings,21)}}} {
#if ((%filesize(1) < %1) or (%1 < 1) or (%filesize(1) < %2) or (%2 < 1) or (%1 > %2)) {#show {Note: Record Empty or Input Error}} {
#var tmc_db_vote_1 %null
#var tmc_db_vote_2 %null
#var tmc_db_rank %null
#read 1 %1
#loop 1,20 {#addkey tmc_db_vote_1 %subregex(%item(@tmc_rankings,%i),"%i\. ([,:\- \w]+) .*","%%%%%1") %subregex(%item(@tmc_rankings,%i),"%i\. [,:\- \w]+ \((\d+)\)","%%%%%1")}
#read 1 %2
#loop 1,20 {#addkey tmc_db_vote_2 %subregex(%item(@tmc_rankings,%i),"%i\. ([,:\- \w]+) .*","%%%%%1") %subregex(%item(@tmc_rankings,%i),"%i\. [,:\- \w]+ \((\d+)\)","%%%%%1")}
#var tmc_rankings 0
#loopdb @tmc_db_vote_1 {
#add tmc_rankings 1
#addkey tmc_db_rank %key @tmc_rankings}
#show {%ansi(6)TMC Top 20 Mud List Rankings}
#show {}
#loopdb @tmc_db_vote_1 {#show {%ansi(2)%db(@tmc_db_rank,%key). %key (%eval(%db(@tmc_db_vote_2,%key)-%val))}}
#show {}
#read 1 %1
#show {%ansi(6)%char(91)%1%char(93) %item(@tmc_rankings,21)}
#read 1 %2
#show {%ansi(6)%char(91)%2%char(93) %item(@tmc_rankings,21)}}}
#close 1}}
#no
#alias tmcz {
#file 1 tmc.zmud.txt
tmc %filesize(1)
#close 1}
#no
#alias tmcxz {
#file 1 tmc.zmud.txt
tmc %eval(%filesize(1)-1) %filesize(1)
#close 1}
#no
#alias tmcaz {
#file 1 tmc.zmud.txt
tmc 1 %filesize(1)
#close 1}
#class 0



Arrow VBScript Code [tested with Microsoft WScript version 5.6 on Windows XP]:

Code:
strHTML = ""
strTEXT = ""
strLINE = ""

Set objApp = CreateObject("Zmud.Application")
Set objSess = objApp.CurrentSession

Sub GetTopTwenty
  Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
  objHTTP.Open "GET", "http://www.mudconnect.com/top20.html", "FALSE"
  objHTTP.Send
  strHTML = objHTTP.ResponseText
  Set objHTTP = Nothing
End Sub

Sub FormatTopTwenty
  intX = instr(strHTML, "1. <")
  intY = instr(strHTML, "<!--Mud Connector Style Guide: BEGIN Footer Section")
  intZ = intY - intX
  strHTML = mid(strHTML, intX, intZ)
  Set objRegExp = New Regexp
  objRegExp.Global = True
  objRegExp.Pattern = "<(.|n)+?>"
    strHTML = objRegExp.Replace(strHTML, "")
  objRegExp.Pattern = "\n(\n|$)"
    strHTML = objRegExp.Replace(strHTML, "")
  objRegExp.Pattern = " \((.|n)+?\)"
    strHTML = objRegExp.Replace(strHTML, "")
  objRegExp.Pattern = "\n(\d+) votes"
    strHTML = objRegExp.Replace(strHTML, " ($1)")
  objRegExp.Pattern = "\n"
    strHTML = objRegExp.Replace(strHTML, "|")
  objRegExp.Pattern = "^(.*)$"
    strHTML = objRegExp.Replace(strHTML, "#var tmc_rankings {$1}")
  Set objRegExp = Nothing
End Sub

Sub ShowTopTwenty
  Call objSess.ProcessCommand(strHTML)
  Call objSess.ProcessCommand("#show {}")
  Call objSess.ProcessCommand("#show {%ansi(6)TMC Top 20 Mud List Rankings}")
  Call objSess.ProcessCommand("#show {}")
  Call objSess.ProcessCommand("#loop 1,20 {#show {%ansi(2)%item(@tmc_rankings,%i)}}")
  Call objSess.ProcessCommand("#show {}")
  Call objSess.ProcessCommand("#show {%ansi(6)%item(@tmc_rankings,21)}")
End Sub

Sub RecordTopTwenty
  Set objFile = CreateObject("Scripting.FileSystemObject")
    If objFile.FileExists("tmc.zmud.txt") Then
      Set objRead = objFile.OpenTextFile("tmc.zmud.txt")
        Do Until objRead.AtEndOfStream
          strLINE = objRead.ReadLine
        Loop
      objRead.Close
      Set objRead = objFile.OpenTextFile("tmc.zmud.txt")
        Do Until objRead.AtEndOfStream
          strTEXT = objRead.ReadAll
        Loop
      objRead.Close
    End If
    Set objWrite = objFile.CreateTextFile("tmc.zmud.txt", True)
      If (strTEXT = "") then
        objWrite.Write(strHTML)
      Else
        If (strHTML = strLINE) then
          objWrite.Write(strTEXT)
        Else
          objWrite.Write(strTEXT & vbCRLF & strHTML)
        End If
      End If
    objWrite.Close
  Set objFile = Nothing
End Sub

GetTopTwenty
FormatTopTwenty
ShowTopTwenty
RecordTopTwenty

Set objSess = Nothing
Set objApp = Nothing



Import Scripts:

1. save zscript code to a file
2. save vbscript code to the file "tmc.zmud.vbs" in the Zmud.exe directory
3. open zMUD and type: #menu {Settings|Import|Script}
4. open zscript code file


Test Input:

Code:
#var tmc_rankings {1. MUME - Multi Users In Middle Earth (5139)|2. BatMUD (5137)|3. SlothMUD III (4643)|4. Medievia (4151)|5. ZombieMUD (3736)|6. Federation II (3478)|7. Shadows of Isildur (2921)|8. Duris: Land of BloodLust (2712)|9. Mozart MUD (2624)|10. Armageddon (2585)|11. LegendMUD (2201)|12. Dreams (2045)|13. Evarayn (2040)|14. Genesis (1854)|15. Abandoned Realms (1799)|16. Wheel of Time (1784)|17. Legends of Karinth (1730)|18. Dark and Shattered Lands (1711)|19. Carrion Fields (1553)|20. Aardwolf (1413)|Rankings Last Generated: Thu Aug 31  0:00:10 2006}
#var tmc_rankings {1. BatMUD (5178)|2. MUME - Multi Users In Middle Earth (5173)|3. SlothMUD III (4652)|4. Medievia (4155)|5. ZombieMUD (3740)|6. Federation II (3483)|7. Shadows of Isildur (2930)|8. Duris: Land of BloodLust (2713)|9. Mozart MUD (2629)|10. Armageddon (2593)|11. LegendMUD (2207)|12. Dreams (2052)|13. Evarayn (2045)|14. Genesis (1857)|15. Abandoned Realms (1801)|16. Wheel of Time (1784)|17. Dark and Shattered Lands (1747)|18. Legends of Karinth (1734)|19. Carrion Fields (1556)|20. Aardwolf (1416)|Rankings Last Generated: Thu Aug 31 12:00:07 2006}
#var tmc_rankings {1. MUME - Multi Users In Middle Earth (5203)|2. BatMUD (5197)|3. SlothMUD III (4660)|4. Medievia (4163)|5. ZombieMUD (3743)|6. Federation II (3495)|7. Shadows of Isildur (2942)|8. Duris: Land of BloodLust (2714)|9. Mozart MUD (2632)|10. Armageddon (2602)|11. LegendMUD (2214)|12. Dreams (2057)|13. Evarayn (2049)|14. Genesis (1859)|15. Abandoned Realms (1805)|16. Wheel of Time (1784)|17. Dark and Shattered Lands (1782)|18. Legends of Karinth (1738)|19. Carrion Fields (1562)|20. Aardwolf (1423)|Rankings Last Generated: Fri Sep  1  0:00:11 2006}
#var tmc_rankings {1. BatMUD (5234)|2. MUME - Multi Users In Middle Earth (5227)|3. SlothMUD III (4669)|4. Medievia (4169)|5. ZombieMUD (3756)|6. Federation II (3503)|7. Shadows of Isildur (2949)|8. Duris: Land of BloodLust (2717)|9. Mozart MUD (2636)|10. Armageddon (2607)|11. LegendMUD (2215)|12. Dreams (2061)|13. Evarayn (2052)|14. Genesis (1861)|15. Dark and Shattered Lands (1823)|16. Abandoned Realms (1808)|17. Wheel of Time (1786)|18. Legends of Karinth (1743)|19. Carrion Fields (1566)|20. Aardwolf (1423)|Rankings Last Generated: Fri Sep  1 12:00:08 2006}


note: do not cut/paste the test input into the zmud command line, instead save it to the file "tmc.zmud.txt" in the Zmud.exe directory


Test Output:

>tmc 3 4
Code:
TMC Top 20 Mud List Rankings

1. MUME - Multi Users In Middle Earth (24)
2. BatMUD (37)
3. SlothMUD III (9)
4. Medievia (6)
5. ZombieMUD (13)
6. Federation II (8)
7. Shadows of Isildur (7)
8. Duris: Land of BloodLust (3)
9. Mozart MUD (4)
10. Armageddon (5)
11. LegendMUD (1)
12. Dreams (4)
13. Evarayn (3)
14. Genesis (2)
15. Abandoned Realms (3)
16. Wheel of Time (2)
17. Dark and Shattered Lands (41)
18. Legends of Karinth (5)
19. Carrion Fields (4)
20. Aardwolf (0)

[3] Rankings Last Generated: Fri Sep  1  0:00:11 2006
[4] Rankings Last Generated: Fri Sep  1 12:00:08 2006


>tmclist
Code:
TMC Top 20 Mud List Rankings

1. Thu Aug 31  0:00:10 2006
2. Thu Aug 31 12:00:07 2006
3. Fri Sep  1  0:00:11 2006
4. Fri Sep  1 12:00:08 2006

Record of Rankings Last Generated



This script will very likely break if someone changes the design of the top20.html page.

The tmc alias without an argument breaks if you are lagging really bad.

If you already used the tmc alias without an argument and wish to see the rankings again then there is no need to re-download the rankings from the mudconnect server, just type the tmcz alias to display the most recent rankings.

The MUD Connector generates its rankings twice a day at midnight and noon (CST I believe) so there is no need to re-download the top20.html page within those time periods.

If you wish to reset all rankings, then delete the tmc.zmud.txt file in the Zmud.exe directory.


Comments Welcome Twisted Evil


Last edited by Full Throttle on Mon Sep 04, 2006 2:28 pm; edited 1 time in total
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sun Sep 03, 2006 10:49 pm   
 
any chance u can do the same for http://www.topmudsites.com/ ?
_________________
http://www.Aardwolf.com
Reply with quote
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Mon Sep 04, 2006 3:32 am   
 
I glanced at the html on topmudsites, the script is doable.

How does topmudsites calculate the rankings?

Would I need to store the 'in' and 'out' count, or just the 'in' count?
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Mon Sep 04, 2006 8:53 am   
 
Just the 'in' count for the rankings. The 'out' count is just for interest.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Sep 04, 2006 2:06 pm   
 
dunno how they get calc'd.
_________________
http://www.Aardwolf.com
Reply with quote
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Mon Sep 04, 2006 3:21 pm   
 
Here is a version for Top Mud Sites.

http://www.topmudsites.com/index.shtml

I only stored the 'in' count.

Commands:

topmud
topmud <m>
topmud <m> <n>
topmudz
topmudxz
topmudaz
topmudlist

Here is an example of the output:

>topmud
Code:
Top Mud Sites Top 20 Rankings

1. Achaea, Dreams of Divine Lands (1681)
2. Aardwolf MUD (1674)
3. Threshold RPG (719)
4. The Carrion Fields (706)
5. Lusternia: Age of Ascension (648)
6. Avatar MUD (581)
7. Discworld mud (512)
8. Imperian (445)
9. Aetolia, the Midnight Age (437)
10. Armageddon (374)
11. MUME - Multi Users in Middle Earth (369)
12. Distant Lands (333)
13. Shattered Kingdoms (321)
14. DartMUD: The Lands of Ferdarchi (301)
15. Shadows of Isildur (265)
16. Xyllomer (216)
17. Aabahran: The Forsaken Lands (213)
18. Unwritten Legends (209)
19. New Worlds (207)
20. Abandoned Realms (203)

Last Updated: 9-4-06 10:00am


Arrow Zscript Code:
Code:
#class {Vote_Scripts}
#var topmud_rankings {0} {0}
#var topmud_db_vote_1 {0} {0}
#var topmud_db_vote_2 {0} {0}
#var topmud_db_rank {0} {0}
#no
#trigger {^Opened topmud.zmud.txt as file %d} {#gag}
#trigger {^Closed topmud.zmud.txt on file %d} {#gag}
#no
#alias topmudlist {
#file 1 topmud.zmud.txt
#show {}
#if (%filesize(1) = 0) {#show {Note: Record Empty}} {
#show {%ansi(6)Top Mud Sites Top 20 Rankings}
#show {}
#loop 1,%filesize(1) {#show {%ansi(2)%i. %subregex(%read(1,%i), ".* Updated: (.*)~}", "%%%1")}}
#show {}
#show {%ansi(6)Record of Rankings Last Updated}}
#close 1}
#no
#alias topmud {
#if (%1 = %null) {#launch {wscript.exe topmud.zmud.vbs}} {
#file 1 topmud.zmud.txt
#show {}
#if (%2 = %null) {
#if ((%filesize(1) < %1) or (%1 < 1)) {#show {Note: Record Empty}} {
#show {%ansi(6)Top Mud Sites Top 20 Rankings}
#show {}
#read 1 %1
#loop 1,20 {#show {%ansi(2)%item(@topmud_rankings,%i)}}
#show {}
#show {%ansi(6)%char(91)%1%char(93) %item(@topmud_rankings,21)}}} {
#if ((%filesize(1) < %1) or (%1 < 1) or (%filesize(1) < %2) or (%2 < 1) or (%1 > %2)) {#show {Note: Record Empty or Input Error}} {
#var topmud_db_vote_1 %null
#var topmud_db_vote_2 %null
#var topmud_db_rank %null
#read 1 %1
#loop 1,20 {#addkey topmud_db_vote_1 %subregex(%item(@topmud_rankings,%i),"%i\. ([,:\- \w]+) .*","%%%%%1") %subregex(%item(@topmud_rankings,%i),"%i\. [,:\- \w]+ \((\d+)\)","%%%%%1")}
#read 1 %2
#loop 1,20 {#addkey topmud_db_vote_2 %subregex(%item(@topmud_rankings,%i),"%i\. ([,:\- \w]+) .*","%%%%%1") %subregex(%item(@topmud_rankings,%i),"%i\. [,:\- \w]+ \((\d+)\)","%%%%%1")}
#var topmud_rankings 0
#loopdb @topmud_db_vote_1 {
#add topmud_rankings 1
#addkey topmud_db_rank %key @topmud_rankings}
#show {%ansi(6)Top Mud Sites Top 20 Rankings}
#show {}
#loopdb @topmud_db_vote_1 {#show {%ansi(2)%db(@topmud_db_rank,%key). %key (%eval(%db(@topmud_db_vote_2,%key)-%val))}}
#show {}
#read 1 %1
#show {%ansi(6)%char(91)%1%char(93) %item(@topmud_rankings,21)}
#read 1 %2
#show {%ansi(6)%char(91)%2%char(93) %item(@topmud_rankings,21)}}}
#close 1}}
#no
#alias topmudz {
#file 1 topmud.zmud.txt
topmud %filesize(1)
#close 1}
#no
#alias topmudxz {
#file 1 topmud.zmud.txt
topmud %eval(%filesize(1)-1) %filesize(1)
#close 1}
#no
#alias topmudaz {
#file 1 topmud.zmud.txt
topmud 1 %filesize(1)
#close 1}
#class 0


Arrow VBScript Code:
Code:
strHTML = ""
strTEXT = ""
strLINE = ""

Set objApp = CreateObject("Zmud.Application")
Set objSess = objApp.CurrentSession

Sub GetTopTwenty
  Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
  objHTTP.Open "GET", "http://www.topmudsites.com/index.shtml", "FALSE"
  objHTTP.Send
  strHTML = objHTTP.ResponseText
  Set objHTTP = Nothing
End Sub

Sub FormatTopTwenty
  intX = instr(strHTML, "<tr bgcolor=#e1e1fc>")
  intY = instr(strHTML, "Next Update:")
  intZ = intY - intX
  strHTML = mid(strHTML, intX, intZ)
  Set objRegExp = New Regexp
  objRegExp.Global = True
  objRegExp.Pattern = "&nbsp;"
    strHTML = objRegExp.Replace(strHTML, "")
  objRegExp.Pattern = "_blank" & chr(34) & ">(.*)</a>"
    strHTML = objRegExp.Replace(strHTML, ">. $1 (")
  objRegExp.Pattern = "<.* size=1>.*\n.*<.* size=2>(\d+)</font></td>\n.*"
    strHTML = objRegExp.Replace(strHTML, "$1)|")
  objRegExp.Pattern = "<(.|n)+?>"
    strHTML = objRegExp.Replace(strHTML, "")
  objRegExp.Pattern = "\n"
    strHTML = objRegExp.Replace(strHTML, "")
  objRegExp.Pattern = "   \d+ Sites In Our Database"
    strHTML = objRegExp.Replace(strHTML, "")
  objRegExp.Pattern = "^(.*)$"
    strHTML = objRegExp.Replace(strHTML, "#var topmud_rankings {$1}")
  Set objRegExp = Nothing
End Sub

Sub ShowTopTwenty
  Call objSess.ProcessCommand(strHTML)
  Call objSess.ProcessCommand("#show {}")
  Call objSess.ProcessCommand("#show {%ansi(6)Top Mud Sites Top 20 Rankings}")
  Call objSess.ProcessCommand("#show {}")
  Call objSess.ProcessCommand("#loop 1,20 {#show {%ansi(2)%item(@topmud_rankings,%i)}}")
  Call objSess.ProcessCommand("#show {}")
  Call objSess.ProcessCommand("#show {%ansi(6)%item(@topmud_rankings,21)}")
End Sub

Sub RecordTopTwenty
  Set objFile = CreateObject("Scripting.FileSystemObject")
    If objFile.FileExists("topmud.zmud.txt") Then
      Set objRead = objFile.OpenTextFile("topmud.zmud.txt")
        Do Until objRead.AtEndOfStream
          strLINE = objRead.ReadLine
        Loop
      objRead.Close
      Set objRead = objFile.OpenTextFile("topmud.zmud.txt")
        Do Until objRead.AtEndOfStream
          strTEXT = objRead.ReadAll
        Loop
      objRead.Close
    End If
    Set objWrite = objFile.CreateTextFile("topmud.zmud.txt", True)
      If (strTEXT = "") then
        objWrite.Write(strHTML)
      Else
        If (strHTML = strLINE) then
          objWrite.Write(strTEXT)
        Else
          objWrite.Write(strTEXT & vbCRLF & strHTML)
        End If
      End If
    objWrite.Close
  Set objFile = Nothing
End Sub

GetTopTwenty
FormatTopTwenty
ShowTopTwenty
RecordTopTwenty

Set objSess = Nothing
Set objApp = Nothing


Import Scripts:

1. save zscript code to a file
2. save vbscript code to the file "topmud.zmud.vbs" in the Zmud.exe directory
3. open zMUD and type: #menu {Settings|Import|Script}
4. open zscript code file

PS-

I updated the tmc zscript code so if a mud name contains a comma (for example: Achaea, Dreams of Divine Lands) then the script won't break.

The tmc and topmud scripts are separate, so there is no problem installing both Twisted Evil
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Sep 05, 2006 12:26 pm   
 
*BOW*
_________________
http://www.Aardwolf.com
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Fri Nov 24, 2006 12:41 am   
 
I just tried installing the TMC Mud List Rankings script and it doesn't work for me.

Initially I was getting an error in Windows Script Host "Permission denied" in the vbscript file at line 62: the line with objFile.CreateTextFile in. I noticed it was creating the text file, but it was empty. After trying it a few times and googling the error but not changing anything, it suddenly started working in so far as no error is now generated and a line is written into the file.

This is the content of the file:
#var tmc_rankings {1. BatMUD (7456)|2. MUME - Multi Users In Middle Earth (7387)|3. Dark and Shattered Lands (6589)|4. Federation II (5945)|5. SlothMUD III (5781)|6. Medievia (5155)|7. ZombieMUD (4794)|8. Shadows of Isildur (4299)|9. Armageddon (3679)|10. Mozart MUD (3279)|11. Duris: Land of BloodLust (3148)|12. LegendMUD (2698)|13. Legends of Karinth (2565)|14. Dreams (2556)|15. Evarayn (2539)|16. Abandoned Realms (2418)|17. Carrion Fields (2237)|18. Genesis (2219)|19. Wheel of Time (1919)|20. Aardwolf (1886)|Rankings Last Generated: Thu Nov 23 12:00:08 2006}

It is all on one line. I assume from the code that this should be on several lines, but I don't know how to fix it.

I have also changed all file manipulation zmud commands to use a variable, e.g. #FILE @tmc_file_num tmc.zmud.txt, since I keep FILE 1 open all the time.
Of course, that doesn't solve my problem, but I can share my changes if wanted.

Anyway, %filesize( @tmc_file_num) returns 1, since it is all on one line. This means that the aliases give errors of the form "Note: Record Empty or Input Error" and "Note: Record Empty".
Reply with quote
Elexin
Newbie


Joined: 12 Aug 2006
Posts: 5

PostPosted: Fri Nov 24, 2006 1:24 am   
 
Anyone know if any of those top 20 are mappable by standard zmud mapper configs?(I.E.- Are any of them mappable without complex scripts and constant editing)
Thankya
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Fri Nov 24, 2006 2:08 am   
 
This is not the right forum for that kind of discussion - this is the "Finished MUD Scripts" forum.
Reply with quote
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Sun Nov 26, 2006 7:46 am   
 
I believe the permission denied error is caused because tmc.zmud.txt is already assigned to another file.

If I type:

#file 3 tmc.zmud.txt;tmc

then I will get the permission denied error.

I would need to type:

#close 3;tmc

for it to work.

You would also get the same error if tmc.zmud.txt has a read-only file attribute.

Also, if tmc.zmud.txt is open with another application (like an editor) when you run the 'tmc' alias, then this may cause a permission denied error.

Seb wrote:
It is all on one line. I assume from the code that this should be on several lines


Nope, it should be on one line and the "Test Input" in the top post should be on four lines.

#var tmc_rankings {1. MUME - Multi Users In Middle Earth (5139)|...}
#var tmc_rankings {1. BatMUD (5178)|...}
#var tmc_rankings {1. MUME - Multi Users In Middle Earth (5203)|...}
#var tmc_rankings {1. BatMUD (5234)|...}

tmc 1 2
tmcxz

If you only have one record, then you will see message: "Note: Record Empty or Input Error"

tmc 1 1
tmcaz

If you only have one record, then the output would be like:

TMC Top 20 Mud List Rankings

1. BatMUD (0)
2. MUME - Multi Users In Middle Earth (0)
3. Dark and Shattered Lands (0)
4. Federation II (0)
5. SlothMUD III (0)
6. Medievia (0)
7. ZombieMUD (0)
8. Shadows of Isildur (0)
9. Armageddon (0)
10. Mozart MUD (0)
11. Duris: Land of BloodLust (0)
12. LegendMUD (0)
13. Legends of Karinth (0)
14. Dreams (0)
15. Evarayn (0)
16. Abandoned Realms (0)
17. Carrion Fields (0)
18. Genesis (0)
19. Wheel of Time (0)
20. Aardwolf (0)

[1] Rankings Last Generated: Sun Nov 26 0:00:08 2006
[1] Rankings Last Generated: Sun Nov 26 0:00:08 2006

Arrow Here is the "Zscript Code" using file #5 instead of file #1

Code:
#class {Vote_Scripts}
#var tmc_rankings {0} {0}
#var tmc_db_vote_1 {0} {0}
#var tmc_db_vote_2 {0} {0}
#var tmc_db_rank {0} {0}
#no
#trigger {^Opened tmc.zmud.txt as file %d} {#gag}
#trigger {^Closed tmc.zmud.txt on file %d} {#gag}
#no
#alias tmclist {
#file 5 tmc.zmud.txt
#show {}
#if (%filesize(5) = 0) {#show {Note: Record Empty}} {
#show {%ansi(6)TMC Top 20 Mud List Rankings}
#show {}
#loop 1,%filesize(5) {#show {%ansi(2)%i. %subregex(%read(5,%i), ".* Generated: (.*)~}", "%%%1")}}
#show {}
#show {%ansi(6)Record of Rankings Last Generated}}
#close 5}
#no
#alias tmc {
#if (%1 = %null) {#launch {wscript.exe tmc.zmud.vbs}} {
#file 5 tmc.zmud.txt
#show {}
#if (%2 = %null) {
#if ((%filesize(5) < %1) or (%1 < 1)) {#show {Note: Record Empty}} {
#show {%ansi(6)TMC Top 20 Mud List Rankings}
#show {}
#read 5 %1
#loop 1,20 {#show {%ansi(2)%item(@tmc_rankings,%i)}}
#show {}
#show {%ansi(6)%char(91)%1%char(93) %item(@tmc_rankings,21)}}} {
#if ((%filesize(5) < %1) or (%1 < 1) or (%filesize(5) < %2) or (%2 < 1) or (%1 > %2)) {#show {Note: Record Empty or Input Error}} {
#var tmc_db_vote_1 %null
#var tmc_db_vote_2 %null
#var tmc_db_rank %null
#read 5 %1
#loop 1,20 {#addkey tmc_db_vote_1 %subregex(%item(@tmc_rankings,%i),"%i\. ([,:\- \w]+) .*","%%%%%1") %subregex(%item(@tmc_rankings,%i),"%i\. [,:\- \w]+ \((\d+)\)","%%%%%1")}
#read 5 %2
#loop 1,20 {#addkey tmc_db_vote_2 %subregex(%item(@tmc_rankings,%i),"%i\. ([,:\- \w]+) .*","%%%%%1") %subregex(%item(@tmc_rankings,%i),"%i\. [,:\- \w]+ \((\d+)\)","%%%%%1")}
#var tmc_rankings 0
#loopdb @tmc_db_vote_1 {
#add tmc_rankings 1
#addkey tmc_db_rank %key @tmc_rankings}
#show {%ansi(6)TMC Top 20 Mud List Rankings}
#show {}
#loopdb @tmc_db_vote_1 {#show {%ansi(2)%db(@tmc_db_rank,%key). %key (%eval(%db(@tmc_db_vote_2,%key)-%val))}}
#show {}
#read 5 %1
#show {%ansi(6)%char(91)%1%char(93) %item(@tmc_rankings,21)}
#read 5 %2
#show {%ansi(6)%char(91)%2%char(93) %item(@tmc_rankings,21)}}}
#close 5}}
#no
#alias tmcz {
#file 5 tmc.zmud.txt
tmc %filesize(5)
#close 5}
#no
#alias tmcxz {
#file 5 tmc.zmud.txt
tmc %eval(%filesize(5)-1) %filesize(5)
#close 5}
#no
#alias tmcaz {
#file 5 tmc.zmud.txt
tmc 1 %filesize(5)
#close 5}
#class 0


I hope that works. I don't understand using a variable @tmc_file_num for the file number.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sun Nov 26, 2006 4:43 pm   
 
Ah, I see. I misunderstood the parameters to the tmc alias.

Regarding the Permission Denied error, you are probably right.

Now that I have two sets of data, my modified code is giving:

Quote:
tmc 1 2

TMC Top 20 Mud List Rankings

1. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
2. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
3. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
4. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
5. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
6. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
7. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
8. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
9. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
10. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
11. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
12. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
13. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
14. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
15. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
16. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
17. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
18. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
19. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))
20. %key( %eval( %db( @tmc_db_vote_2, %key)-%val))

[1] Rankings Last Generated: Thu Nov 23 12:00:08 2006
[2] Rankings Last Generated: Sun Nov 26 0:00:08 2006


What is strange is that it appears to be this part:
Code:
#LOOPDB @tmc_db_vote_1 {#SHOW {%ansi( 2)%db( @tmc_db_rank, %key). %key( %eval( %db( @tmc_db_vote_2, %key)-%val))}}

that is not displaying right. However If I execute this code from the command line I get the correct output. Here is my modified code at the moment (with some variables restored to their defaults for brevity - they are actually all populated fine). You'll see what I mean about using @tmc_file_num... It seems to work fine with a variable. Except that I've just tried your zScript code using file #5 and it works fine for me... *ponder*

Code:
#CLASS {Vote_Scripts_TMC}
#ALIAS tmclist {
  #FILE @tmc_file_num tmc.zmud.txt
  #SHOW {}
  #IF (%filesize( @tmc_file_num) = 0) {#SHOW {Note: Record Empty}} {
    #SHOW {%ansi( 6)TMC Top 20 Mud List Rankings}
    #SHOW {}
    #LOOP 1,%filesize( @tmc_file_num) {#SHOW {%ansi( 2)%i. %subregex( %read( @tmc_file_num, %i), ".* Generated: (.*)~}", "%%%1")}}
    #SHOW {}
    #SHOW {%ansi( 6)Record of Rankings Last Generated}
    }
  #CLOSE @tmc_file_num
  }
#ALIAS tmc {
  #IF (%1 = %null) {#LAUNCH {wscript.exe tmc.zmud.vbs}} {
    #FILE @tmc_file_num tmc.zmud.txt
    #SHOW {}
    #IF (%2 = %null) {
      #IF ((%filesize( @tmc_file_num) < %1) or (%1 < 1)) {#SHOW {Note: Record Empty}} {
        #SHOW {%ansi( 6)TMC Top 20 Mud List Rankings}
        #SHOW {}
        #READ @tmc_file_num %1
        #LOOP 1,20 {#SHOW {%ansi( 2)%item( @tmc_rankings, %i)}}
        #SHOW {}
        #SHOW {%ansi( 6)%char( 91)%1%char( 93) %item( @tmc_rankings, 21)}
        }
      } {
      #IF ((%filesize( @tmc_file_num) < %1) or (%1 < 1) or (%filesize( @tmc_file_num) < %2) or (%2 < 1) or (%1 > %2)) {#SHOW {Note: Record Empty or Input Error}} {
        #VAR tmc_db_vote_1 %null
        #VAR tmc_db_vote_2 %null
        #VAR tmc_db_rank %null
        #READ @tmc_file_num %1
        #LOOP 1,20 {#ADDKEY tmc_db_vote_1 %subregex( %item( @tmc_rankings, %i), "%i\. ([,:\- \w]+) .*", "%%%%%1") %subregex( %item( @tmc_rankings, %i), "%i\. [,:\- \w]+ \((\d+)\)", "%%%%%1")}
        #READ @tmc_file_num %2
        #LOOP 1,20 {#ADDKEY tmc_db_vote_2 %subregex( %item( @tmc_rankings, %i), "%i\. ([,:\- \w]+) .*", "%%%%%1") %subregex( %item( @tmc_rankings, %i), "%i\. [,:\- \w]+ \((\d+)\)", "%%%%%1")}
        #VAR tmc_rankings 0
        #LOOPDB @tmc_db_vote_1 {
          #ADD tmc_rankings 1
          #ADDKEY tmc_db_rank %key @tmc_rankings
          }
        #SHOW {%ansi( 6)TMC Top 20 Mud List Rankings}
        #SHOW {}
        #LOOPDB @tmc_db_vote_1 {#SHOW {%ansi( 2)%db( @tmc_db_rank, %key). %key( %eval( %db( @tmc_db_vote_2, %key)-%val))}}
        #SHOW {}
        #READ @tmc_file_num %1
        #SHOW {%ansi( 6)%char( 91)%1%char( 93) %item( @tmc_rankings, 21)}
        #READ @tmc_file_num %2
        #SHOW {%ansi( 6)%char( 91)%2%char( 93) %item( @tmc_rankings, 21)}
        }
      }
    #CLOSE @tmc_file_num
    }
  }
#ALIAS tmcz {
  #FILE @tmc_file_num tmc.zmud.txt
  tmc %filesize( @tmc_file_num)
  #CLOSE @tmc_file_num
  }
#ALIAS tmcxz {
  #FILE @tmc_file_num tmc.zmud.txt
  tmc %eval( %filesize( @tmc_file_num)-1) %filesize( @tmc_file_num)
  #CLOSE @tmc_file_num
  }
#ALIAS tmcaz {
  #FILE @tmc_file_num tmc.zmud.txt
  tmc 1 %filesize( @tmc_file_num)
  #CLOSE @tmc_file_num
  }
#VAR tmc_rankings {0} {0}
#VAR tmc_db_vote_1 {0} {0}
#VAR tmc_db_vote_2 {0} {0}
#VAR tmc_db_rank {0} {0}
#VAR tmc_file_num {4}
#TRIGGER {^Opened tmc.zmud.txt as file %d} {#GAG} "" {disable}
#TRIGGER {^Closed tmc.zmud.txt on file %d} {#GAG} "" {disable}
#CLASS 0
Reply with quote
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Sun Nov 26, 2006 7:15 pm   
 
change "%key( %eval" to "%key (%eval" in your modified code, that fixed it here
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Mon Nov 27, 2006 11:01 am   
 
Genius! I had to turn off Pretty Print, as it kept changing it back! Thanks for your help!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Aug 20, 2007 5:41 pm   
 
Hmmm... can anyone make a script to vote for your favorite MUD from zMUD? I'm looking mainly for Topmudsites, but TMC could be coded too for others. Just a thought.

Charneus
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Aug 20, 2007 5:45 pm   
 
You can use the #url command to open the voting page, but you can't do more than that unless your browser lets you follow links on displayed pages via COM. There's certainly no way to do it silently from within zMUD.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Aug 20, 2007 5:47 pm   
 
Ugh. That sucks. I have a PERL script (from a friend of mine) that will do the voting for me, but when the only thing I like to have open is zMUD... Oh well. :)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Aug 20, 2007 5:50 pm   
 
Well, if you were using CMUD you could install ActivePerl and use Perl from within an alias or trigger.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Aug 20, 2007 5:53 pm   
 
Yeah. I have CMUD. Just gonna hold off installing it (and using my license) until I get a new computer. My old one decided to blow up on me. I'll have to see if I can figure out how to do that. I think I tried before, and wasn't successful.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Aug 20, 2007 10:41 pm   
 
You can get ActivePerl for free here. CMUD should automatically recognise that it's installed and add Perl to the drop-down Language menu for any setting. Then you can use CMUD to run your Perl script.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Sir1l
Wanderer


Joined: 01 Oct 2005
Posts: 54

PostPosted: Sun Nov 11, 2007 7:45 pm   
 
Very Happy


Last edited by Sir1l on Mon Nov 12, 2007 7:24 pm; edited 1 time in total
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Mon Nov 12, 2007 4:40 pm   
 
I fixed this problem for Charneus I forgot to post it here. They moved a page. I will do a search and post the changes here.

Ok so what changes need to be made to the vbs to account for the changes at topmudsites?
Code:
objHTTP.Open "GET", "http://www.topmudsites.com/index.shtml", "FALSE"
to
objHTTP.Open "GET", "http://www.topmudsites.com/", "FALSE"
and
intY = instr(strHTML, "Next Update:")
to
intY = instr(strHTML, "</body>")
Of course if topmudsites decides to change things again then the script will once again need to be changed.
_________________
Taz :)
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Fri Apr 11, 2008 9:02 am   
 
Charneus wrote:
Hmmm... can anyone make a script to vote for your favorite MUD from zMUD? I'm looking mainly for Topmudsites, but TMC could be coded too for others. Just a thought.

Fang Xianfu wrote:
You can use the #url command to open the voting page, but you can't do more than that unless your browser lets you follow links on displayed pages via COM. There's certainly no way to do it silently from within zMUD.

It is quite possible, actually. I made such a script myself while working on a completely different goal.
I never released it because the script makes it too possible to easily violate the TMS voting rules, and nobody likes cheaters.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Apr 11, 2008 9:36 am   
 
How? I was under the impression that TMS logs your IP to give you a certain number of votes per time period. How does that break the rules?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Fri Apr 11, 2008 11:38 pm   
 
Fang Xianfu wrote:
How? I was under the impression that TMS logs your IP to give you a certain number of votes per time period. How does that break the rules?

It could be installed on other people's machines and would run silently and automatically in the background without anyone knowing since it technically doesn't require zMUD at all. I'm not opposed to the script itself, just wary of it being used for ill.
What's your opinion?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net