Basically, we see a *ton* of the same stuff recycled over and over again, new scripts posted that depend on old libs that aren't making full use of the core because they're recycled and converted from other bots from D2NT or D2JSP. While these work, happily so, they bring along a lot of bugs because D2BS has a lot of functions that are generally not used, or not efficiently used.
Anyway, asking people who are doing individual scripts, or want to show off some snippets of code that isn't the same old NTM_GoHere(); NTA_KillThis(); stuff.
I think it'll help people learn a bit more, I've updated the API a little bit *pokes lord2800*, which is helpful, but I do think that it'll help people to see code that works without depending on a gazillion includes to make it work, I think people who are learning are better off seeing example individually then looking at how NTTM calls NTM which calls NTA which calls a core function to do NT_DoThis();. I could be wrong.
Anyway, here's an example of my XferBot, this is the D2BS side of the code, there's also a mIRC side of the code. Probably the most important part of this is js_strict(true);, I like to always have that in place, and heed/fix any warnings it throws.
The example below shows you how to login, make a game, send messages to IRC, and a bit of anti-idling.
sendDDE is a great feature that is UNIQUE to d2bs, you can send DDE (Dynamic Data Exchange) messages to any application that has a DDE server, I use it to send messages to #MultiBot, and PM. You can also use it to execute other mIRC commands, and it'd make a cool notification system, especially if you use different computers to bot on like I do.
I'll be posting lots more like this in time.
starter.dbj:
js_strict(true);
include('gamemanager.dbl');
function main()
{
login('timex-xfer');
createGame("Xfer" + rand(1,5000), "xfer" + rand(1,5000));
};
default.dbj:
js_strict(true);
function main() {
sendDDE(1, "logger", "command", "", "/set %WestGame " + me.gamename);
sendDDE(1, "logger", "command", "", "/set %WestPass " + me.gamepassword);
sendDDE(1, "logger", "command", "", "//msg %WestXferNick 14Xferbot is waiting for you in %WestGame // %WestPass ");
sendDDE(1, "logger", "command", "", "//msg %WestXferNick 4Do not forget to tell me !Done when you are done, or you may be banned!");
while (me.ingame) {
delay(30000);
say("Anti-Idle Message!");
if (me.gametype == 1) {
weaponSwitch(0);
}
}
};