IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: Amis on May 18, 2008, 08:54:42 AM

Title: Random jokes
Post by: Amis on May 18, 2008, 08:54:42 AM
It's just a really basic script what export random jokes from www.randomjokes.com (One liners category).
Snerf: can you give me a hint on how I can add the HTTP script that you used in the new google? I can't make it work...

Command: !joke

http://amis.weasy.net/jokes.ice (http://amis.weasy.net/jokes.ice)
Title: Re: Random jokes
Post by: Snerf on May 18, 2008, 12:17:19 PM
What cant you make work?  Need a bit more specifics then that. :mrgreen:
Title: Re: Random jokes
Post by: Amis on May 19, 2008, 01:30:01 AM
Old http script begin with this:
Code: [Select]
Set http = CreateObject("Microsoft.XmlHttp")
url = "some url"
http.open "GET", URL, FALSE
http.send ""
response = http.responsetext

The new:
Code: [Select]
Set http = CreateObject("Microsoft.XmlHttp")
url = "some url"
http.onreadystatechange = getRef("ProcessData")
http.open "GET", url, True
http.send
End Sub

Function ProcessData()
if http.readyState = 4 then
    if http.status = 200 then
etc...
Title: Re: Random jokes
Post by: Snerf on May 19, 2008, 11:34:50 AM
Did you "Dim http" on the top of the script, like I did, as it now needs to be a global object, since your using it in multiple subs/functions.