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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Apr 27, 2008 10:17 am   

grabbing text or source from a website
 
I have looked into several topics, but didn't find any answer to this.
how would I look into a website, copy everything it shows, and then send it to the mud?
I did find something about QuoteDB, but that script didn't seem to work, not even the example.

any help would be appreciated
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Apr 27, 2008 10:27 am   
 
I think there was a script in the Finished Scripts forum that sent a query to a web page and pulled the results into zMud. I seem to remember it being something about mud connector. I also think there was one that used babelfish to do translations. You can try hunting for them to see a starting point for doing it.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Apr 27, 2008 11:01 am   
 
hmm, that script seems pretty complex, and I don't know anything about VBScript either, but I'll try working on it
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Apr 27, 2008 11:22 am   
 
ok, I managed to get it to work, but now I have another problem.

I want to change the url in tmc.zmud.vbs, how would I get zmud to change it?
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Apr 27, 2008 12:33 pm   
 
ok, I'm done, I still need to find a way to do that cateory changer.
this is for QuoteDB

Code:
#CLASS {Vote_Scripts}
#ALIAS tmc {#file 1 tmc.zmud.txt;#gag;#era 1;#gag;#close 1;#gag;#file 1 tmc.zmud.txt;#gag;#close 1;#gag;#launch {wscript.exe tmc.zmud.vbs};#wait 3000;#file 1 tmc.zmud.txt;#gag;#var quote %read( 1);#say @quote;#wait 500;say '@quoteend' -@authorquote}
#TRIGGER {document.write*'(*)<br>*;document.write*'More quotes from <a href=http://www.quotedb.com/authors/(*)>*</a>'*;} {#var quoteend "%1";#var authorquote "%2";#var authorquote %replace( @authorquote, "-", " ")}
#CLASS 0


and the VBscript.
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.quotedb.com/quote/quote.php?action=random_quote", "FALSE"
  objHTTP.Send
  strHTML = objHTTP.ResponseText
  Set objHTTP = Nothing
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
RecordTopTwenty

Set objSess = Nothing
Set objApp = Nothing


as you can see, I just took the "mud connector" script and changed it a little bit.

and here's the category changer I made for it.

Code:
#CLASS {AddOnScripts|Random Quote} {enable}
#ALIAS pickcategory {#PICK {@categories}}
#ALIAS cg {#var category %1;#echo your option was @category!}
#VAR category {126Computers}
#VAR categories {p:Select a category|o:1|cg 49America|cg 69Anger|cg 96Animals|cg 44Art|cg 40Beauty|cg 50Children|cg 8Comedy|cg 126Computers|cg 38Education|cg 121Emotion|cg 98Envy|cg 80Experience|cg 31Faith|cg 119Fame|cg 86Family|cg 48Fear|cg 77Food|cg 13Freedom|cg 6Friendship|cg 2God|cg 7Government|cg 45Happiness|cg 91Health|cg 117History|cg 66Holidays|cg 115Hope|cg 74Humor|cg 101Inspiration|cg 93Justice|cg 27Leadership|cg 43LifeandDeath|cg 5Love|cg 14Miscellaneous|cg 37Money|cg 11Morality|cg 28Patriotism|cg 62Philosophy|cg 20Politics|cg 109Power|cg 84Pride|cg 29Race|cg 39Reading|cg 60Religion|cg 71Risk|cg 15Science|cg 53Sex|cg 76Sleep|cg 75Sports|cg 9Success|cg 79Talking|cg 73Thinking|cg 51Time|cg 33TruthandLies|cg 64Virtue|cg 32WarandPeace|cg 81Wisdom|cg 34Work|cg 26Writing}
#VAR numbercat {126}
#VAR wordcat {Computers}
#TRIGGER {your option was (%d)(%w)!} {#var numbercat %1;#var wordcat %2;#var linkcat "http://www.quotedb.com/quote/quote.php?action=random_quote&c[@numbercat]=@numbercat";say @wordcat ...your link is @linkcat;#mxp ~<a "@linkcat">clicky clicky</a>}
#CLASS 0


edit: I found an error, fixed it
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
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