Author Topic: [JS] Clean Slate WebBot  (Read 5252 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
[JS] Clean Slate WebBot
« on: November 21, 2009, 11:25:32 pm »
When I was sifting through files on joe.javaop.com, I found a bunch of stuff that might be of some value (nostalgic or otherwise) to someone. I'm going to clean a bunch of it up and post it here, since the BotDev forum is dead.

Of course, this won't work. Not only is CSB incapable of connecting to Battle.net (and has been for years), but I don't remember how I used to construct a CSB in VBScript/JavaScript. But still, I think this is cool.

Code: [Select]
<!--
  CSB WebBot
  Written by Joe[x86]
-->

<html>
  <head>
    <title>CSB WebBot by Joe[x86]</title>
  </head>
  <body>
    HTML Webbot by Joe[x86] loaded.<br />
    Thanks to Cuphead[vL] and zorm[vL] for writing CSB.<br />
   
    <script Language="javascript">
        // Configure the bot
        CSB.Accept      = 579728
        CSB.Username    = InputBox("Username?")
        CSB.Password    = InputBox("Password?")
        CSB.Product     = InputBox("Product (4-Byte Reversed)?")
        CSB.Server      = InputBox("Server?")
        CSB.CDKey       = InputBox("Key?")
        CSB.HomeChannel = InputBox("Home channel?")
        // Connect the bot
        CSB.Connect
    </script>
  </body>


  <script language="javascript" for="CSB" event="BnetConnected">
    document.write("[BNCS] Connected!<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="BnetConnecting">
    document.write("[BNCS] Connecting..<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="BnetDisconnected">
    document.write("[BNCS] Disconnected!<br>\n");
  </script>

  <script language="javascript" for="CSB" event="BnetError">
    document.write("[BNCS] Error " + ErrorNumber + ": " + Description
            + ".<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="BNLSAuthEvent">
    if (Success) {
      document.write("[BNLS] Authorized!<br>\n");
    } else {
      document.write("[BNLS] Authorization failed!<br>\n");
    }
  </script>
       
  <script language="javascript" for="CSB" event="BNLSConnected">
    document.write("[BNLS] Connected!<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="BNLSConnecting">
    document.write("[BNLS] Connecting..<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="BNLSError">
    document.write("[BNLS] Error " + ErrorNumber + ": " + Description
            + ".<br>\n");
  </script>
     
  <script language="javascript" for="CSB" event="JoinedChannel">
    document.write("[BNCS] Joined Channel " + ChanelName + ".<br>\n");
  </script>
     
  <script language="javascript" for="CSB" event="LoggedOnAs">
    document.write("[BNCS] Logged on as " + Username + " using " + Product
            + ".<br>\n");
  </script>

  <script language="javascript" for="CSB" event="LogonEvent">
    switch (Message) {
        default:
            document.write("[BNCS] Logon Event: Unhandled LogonEvent -- "
                    + Message + ".<br>\n");
    }
  </script>
       
  <script language="javascript" for="CSB" event="News">
    document.write("[BNCS] News: " + News + "<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="ServerError">
    document.write("[BNCS] Error: " + Message + "<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="ServerInfo">
    document.write("[BNCS] Info: " + Message + "<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="UserEmote">
    document.write(Username + " (Emote): " + Message + "<br>\n");
  </script>
       
  <script language="javascript" for="CSB" event="UserInChannel">
    document.write(Username + " is in the channel using " + Product
            + " with a ping of " + Ping + ".");
  </script>
       
  <script language="javascript" for="CSB" event="UserJoins">
    document.write(Username + " has joined the channel using " + Product + ".");
  </script>
     
  <script language="javascript" for="CSB" event="UserLeaves">
    document.write(Username + " has left the channel.");
  </script>

  <script language="javascript" for="CSB" event="UserTalk">
    document.write(Username + ": " + Message);
  </script>
     
  <script language="javascript" for="CSB" event="VersionCheck">
    Select Case Message
      Case Else
        document.write("[BNLS] Version Check: Unhandled Byte: " + Message
                + ". ExtraInfo: " + ExtraInfo);
    End Select
  </script>
       
  <script language="javascript" for="CSB" event="WhisperFromUser">
    document.write(Username + " (Whisper): " + Message);
  </script>
       
  <script language="javascript" for="CSB" event="WhisperToUser">
    document.write("You whisper to " + Username + ": " + Message);
  </script>
 
</html>
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Camel

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
    • BNU Bot
Re: [JS] Clean Slate WebBot
« Reply #1 on: November 23, 2009, 11:36:04 am »
Document.write() is deprecated these days :)

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: [JS] Clean Slate WebBot
« Reply #2 on: November 23, 2009, 01:15:29 pm »
Since when?
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Camel

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
    • BNU Bot
Re: [JS] Clean Slate WebBot
« Reply #3 on: November 23, 2009, 01:34:23 pm »
Since when?
Since even IE supports OO JS manipulation of the DOM. Document.write() is slower, because the browser has to bring up the HTML parser, and follow the whole chain as if it were re-rendering the page from scratch.

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: [JS] Clean Slate WebBot
« Reply #4 on: November 23, 2009, 02:48:24 pm »
Agreed. JinxBot and the web version manipulate the DOM tree with document.createElement() and element.appendChild().
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.