|  |
|  |
10-09-2007, 03:34 PM
|
#1 (permalink)
| BattleForums Newbie
Join Date: Jul 2005 Age: 20 Posts: 16
| Niren7's abot - D2h mods. Firstly i need Niren7's abot source.
Then i need information how to turn c++ scripts to *d2h, or opposite.
Plus any information about creating d2hackit bots, would be nice
And one d2j script containing some kind of error(maybe): Code: function getBoughtItem(item) {
//scanning for the new one
newitem = getUnit(4,null,1);
delay(100);
// If we have a item, check if it is in the old list
if (newitem) { do {
var new_item=true;
for (var x=0; x<sellarray.length; x+=1) {
if (sellarray[x]==newitem.gid) { new_item=false; }
}
if (new_item) { return newitem; }
} while (newitem.getNext(null,1)); }
return false;
Last edited by kayen; 10-09-2007 at 04:45 PM.
|
| |
10-09-2007, 09:22 PM
|
#2 (permalink)
| BattleForums Member
Join Date: May 2003 Location: Arkansas Posts: 406
| Should you say please not just demand
__________________ |
| |
10-10-2007, 03:09 PM
|
#3 (permalink)
| BattleForums Newbie
Join Date: Jul 2005 Age: 20 Posts: 16
| Quote:
Originally Posted by SmileZ Should you say please not just demand | Please. Good ? 
Or should i start flooding "plz plzzzzz plz plz plzzzz"  |
| |
10-15-2007, 11:10 PM
|
#4 (permalink)
| BattleForums Addict
Join Date: May 2003 Posts: 689
| - That script looks like javascript.
- C++ requires that you compile its code into binary format (specific to the OS/compiler).
- A d2h is just a DLL file, compiled in C/C++ with the d2hackit framework included.
- There are probably old tutorials about making d2hackit plugins. Sadly, d2hackit is one of those things that has entered internet oblivion. Even if you manage to resurrect something...and are creative somehow...you are several years too late... Everytime i get the urge to look at my old cpp files for d2 I remember that my time could be better spent elsewhere.
If you still want to continue, let me know and I'll give you some sample d2h plugin source files.
Cheers
__________________ ----------------------------------
Member of BFHS and Coder for the TradeHack 2,3,4, RBXP, ItemHash, bulletTime d2hackit modules.
--------------------------------- |
| |
10-19-2007, 03:53 PM
|
#5 (permalink)
| BattleForums Newbie
Join Date: Jul 2005 Age: 20 Posts: 16
| @Ultimate Empire yes what source files would be nice.
And about what script, i know it's java. It's taken from d2jsp.
However the script doesn't work. It's taken from a gamble bot. It gambles and then generates gold with 'grinding' weapon bug. But it stucks at the part after selling the weapon, somehow it doesn't detects the sold weapon in shop or it doesn't buy it.So i guess the error is in these parts : Code: function getBoughtItem(item) {
//scanning for the new one
newitem = getUnit(4,null,1);
delay(100);
// If we have a item, check if it is in the old list
if (newitem) { do {
var new_item=true;
for (var x=0; x<sellarray.length; x+=1) {
if (sellarray[x]==newitem.gid) { new_item=false; }
}
if (new_item) { return newitem; }
} while (newitem.getNext(null,1)); } Or this: Code: function makegold()
{
if (getUIFlag(0x0c))
{
// myweaponforsale=getUnitByGID(myweapongid);
// if (myweaponforsale != 0 && myweaponforsale != null)
myweapon.shop(anya,1);
while (me.getStat(14)+me.getStat(15) <810000)
{
anya = getUnit(1,"Anya");
ShopIt("Anya",anya);
getBoughtItem();
delay(75);
newitem.shop(anya,1);
delay(75);
}
delay(750);
ShopIt("Anya",anya);
}
else
{
makegold();
} The whole code: Code: function main()
{
print("Most of this script is cobbled together from other scripts.)");
loadincludes();
GambleItOn=true;
// Town=new TownMove();
// Town.Init();
selling();
if (checkgrinding())
{
myweapongid = myweapon.gid;
print(myweapongid);
checkact();
if (AS_CheckInventory())
{
walkto(5106, 5043);
delay(100);
walkto(5110, 5065);
delay(100);
walkto(5123, 5058);
delay(100);
NPCinteract(stash);
delay(100);
walkto(5110, 5065);
delay(100);
}
gotoanya();
while (true)
{
while (!AS_CheckInventory())
{
while (checkgold() && !AS_CheckInventory())
{
anya = getUnit(1,"Anya");
delay(100);
anya.interact();
delay(500);
anya.useMenu(0x0D46);
delay(500);
GambleIt("Anya",anya);
delay(500);
GambleIt("Anya",anya);
// delay(500);
// GambleIt("Anya",anya);
// delay(500);
// GambleIt("Anya",anya);
anya.cancel(0);
}
while (!checkgold())
{
anya = getUnit(1,"Anya");
delay(100);
anya.interact();
delay(500);
anya.useMenu(0x0D44);
delay(500);
makegold();
anya.cancel(0);
}
}
gotostash();
walkto(5110, 5065);
delay(100);
gotoanya();
}
}
else
{
print("would be quitting");
// quit();
}
idle();
}
function loadincludes()
{
include("gamble-pwninclude.d2l");
include("gamble-pwnsettings.d2l");
include("gamble-Aet_Sta****.d2l");
include("gamble-bmpwnit.d2l");
}
function checkgrinding()
{
wep=weaponcheck();
print(myweapon.prefix);
if (myweapon.prefix != "Grinding")
{
weaponSwitch();
delay(500);
wep=weaponcheck();
print(myweapon.prefix);
if (myweapon.prefix != "Grinding")
{
print("Need a grinding weapon");
}
else return(true);
}
else return(true);
}
function weaponcheck() {
myweapon = getUnit(4,null,1);
if(myweapon)
while(myweapon.getNext(null,1))
{
if((myweapon.itemloc == 4 || myweapon.itemloc == 5) &&
myweapon.itemtype != 51 && myweapon.itemtype != 2 && myweapon.itemtype != 70 && myweapon.code != "aqv" &&
myweapon.code != "cqv")
{
weaponLoc = myweapon.itemloc;
return myweapon;
}
}
return false;
}
function grindsell()
{
grindwep = getUnit(4,null,1)
if(grindwep)
while(grindwep.getNext(null,1))
{
if(grindwep.prefix == "Grinding")
print("yay");
return grindwep
}
print("****");
return false;
}
function checkact()
{
if (me.act < 5)
{
print("You are not in act 5! Going from act #" + me.act + " to act #5");
switch (me.act)
{
case 1: roguechange(); break;
case 2:
walkto(5127, 5175);
walkto(5120, 5133);
walkto(5094, 5113);
walkto(5069, 5086);
break;
case 3:
walkto(5131, 5168);
walkto(5133, 5151);
walkto(5133, 5136);
walkto(5133, 5122);
walkto(5132, 5104);
walkto(5133, 5092);
walkto(5147, 5093);
walkto(5149, 5079);
walkto(5154, 5066);
walkto(5160, 5054);
walkto(5159, 5049);
break;
case 4: walkto(5044, 5019); break;
}
ChangeArea("Waypoint",109,0x6d)
position = "waypoint";
} else return true;
if (me.act != 5) print("You're not in act 5!");
}
function gotoanya()
{
walkto(5106,5043);
walkto(5110,5062);
walkto(5119,5085);
walkto(5129,5105);
walkto(5129,5112);
walkto(5118,5118);
walkto(5107,5116);
}
function dprint(string) {
logfile = "output/"+me.name+"-cowbot.txt";
//print(string);
f = fileOpen(logfile, 2);
if (!f) {
print("Failed to open " + logfile + " for logging"); }
else {
f.writeLine(string);
f.close();
}
}
function checkgold()
{
if (me.getStat(14)+me.getStat(15) >310000)
{
return(true);
}
else return(false);
}
function EnterTrade(npc,type) {
// If we called this function without assigning a NPC object, warn the user
if (!npc) {
dprint("EnterTrade() : No NPC object is entered");
return false;
}
else {
// If we are already interacted, stop right now
if (getUIFlag(0x0c) && getUnit(4,null,101)) {
dprint("EnterTrade() : Already in trade or gamble trade with " + npc.name);
return true;
}
}
// If the function is called without entering the type, set to 0 by default
if (arguments.length<2) { type=0; }
// Init the timer
var _timer = timeout * 1000;
// Loop while you are not interacted
do {
// For each second, retrade with the npc
if ((_timer % 1000) === 0) {
if (npc.name==larzuk) { npc.useMenu(0x0D06); }
else if (type == 1 && npc.name==anya) { npc.useMenu(0x0D46); }
else { npc.useMenu(0x0D44); }
}
_timer -= 50;
delay(50);
}while(!getUIFlag(0x0c) && _timer > 0);
// If we are still not trading with the npc
if(!getUIFlag(0x0c)) {
print("EnterTrade() : Failed to trade with " + npc.name + "!");
return false;
}
// Wait a certain delay before returning to the caller
DoDel(npcdelay);
return true;
}
function NPCinteract(who) {
if(who==stash) { npc = getUnit(2,stash); }
else { npc = getUnit(1,who); }
if (npc) {
EnterInteraction(npc);
switch (who) {
case qual:
if (!ReviveMerc(npc)) {
if (stopnomerc) { quitmessage("Restarting the game..."); }
}
break;
case larzuk:
EnterTrade(npc);
RepairItems(npc);
if (checkammo()) { buyammo(npc); }
break;
case malah:
ManageItems(npc);
break;
case anya:
if (GambleItOn) {
if (AS_MyGold() > MinGoldToGamble) {
EnterTrade(npc,1);
GambleIt(who,npc);
MenuCancel(npc,1);
EnterInteraction(npc);
}
}
break;
case stash:
AS_ManageStash();
break;
}
if (who==stash) { MenuCancel(npc,0); }
else { MenuCancel(npc,1); }
}
}
function EnterInteraction(npc) {
// If we called this function without assigning a NPC object, warn the user
if (!npc) {
dprint("EnterInteraction() : No NPC object is entered");
return false;
}
else {
// Enter the right uiflag depending if the npc is a stash or not.
var _uiflag=(npc.name==stash)?0x19:0x08;
// If we are already interacted, stop right now
if (getUIFlag(_uiflag)) {
dprint("EnterInteraction() : Already interacted with " + npc.name);
return true;
}
}
// Init the timer
var _timer = timeout * 1000;
// Loop while you are not interacted
do {
// For each second, reinteract with the npc
if ((_timer % 1000) === 0) {
if (_timer <= 6000) {
npc.cancel(1);
delay(250);
}
clickMap(0, 0, npc);
delay(clickdel + rnd(20,60));
clickMap(2, 0, npc);
}
_timer -= 50;
delay(50);
}while(!getUIFlag(_uiflag) && _timer > 0);
// After the loop, if we are still not interacted, log the error
if (!getUIFlag(_uiflag)) {
print("EnterInteract() : Failed to interact with " + npc.name);
return false;
}
// Wait a certain delay before returning to the caller
DoDel(npcdelay);
// If we got there, we are interacted
return true;
}
function MenuCancel(npc,how) {
// Check the arguments
if (!npc) {
dprint("PXP_IT_DoCancel() : No NPC object is entered");
return true;
}
else if (arguments.length<2) {
dprint("PXP_IT_DoCancel() : No enough arguments is entered");
return true;
}
// If there is no flags set to true, all is cancelled already
var UIFlagStatus = _PXP_IT_CheckUI();
if(!UIFlagStatus) {
dprint("PXP_IT_DoCancel() : Already cancelled!");
return false;
}
// Init the timer
var _timer = timeout * 1000;
// Loop while you are not interacted
do {
dprint("Timer now at " + _timer);
// For each 0.5 second, retry the cancel
if ((_timer % 500) === 0) {
if (_timer <= 6000) {
dprint("Now retrying to cancel");
npc.cancel(how);
}
}
_timer -= 25;
delay(25);
UIFlagStatus = _PXP_IT_CheckUI();
}while(UIFlagStatus && _timer > 0);
// Check if the cancel is correctly done
if (!UIFlagStatus) {
dprint("PXP_IT_DoCancel() : Menus cancel done!");
return false;
}
else {
dprint("PXP_IT_DoCancel() : Unable to cancel the menus!");
return true;
}
}
function _PXP_IT_CheckUI() {
dprint("_PXP_IT_CheckUI() : Checking the UI flags");
//Default flags
var _uiflags=[0x08,0x0c,0x0d,0x14,0x19,0x1a];
var _flags=false;
//Check if the flags are present, then push them into the array
for(j=0; j<_uiflags.length; j++) {
if(getUIFlag(_uiflags[j])) {
if(!_flags) { _flags=new Array(); }
_flags.push(_uiflags[j]);
}
}
// Return true if there is still flags in the array
if(!_flags || _flags.length<1) {
dprint("_PXP_IT_CheckUI() : The flags array is empty");
return false;
}
else {
dprint("_PXP_IT_CheckUI() : The flags array is not empty (the array got " + _flags.length + " elements)");
return true;
}
}
/*
function makegold()
{
if (getUIFlag(0x0c))
{
sendDDE(1,"mIRC","command","","/run makegold.aut");
delay(65000);
}
else
{
makegold();
}
}
*/
function makegold()
{
if (getUIFlag(0x0c))
{
// myweaponforsale=getUnitByGID(myweapongid);
// if (myweaponforsale != 0 && myweaponforsale != null)
myweapon.shop(anya,1);
while (me.getStat(14)+me.getStat(15) <810000)
{
anya = getUnit(1,"Anya");
ShopIt("Anya",anya);
getBoughtItem();
delay(75);
newitem.shop(anya,1);
delay(75);
}
delay(750);
ShopIt("Anya",anya);
}
else
{
makegold();
}
}
function gotostash()
{
walkto(5107,5116);
walkto(5118,5118);
walkto(5129,5112);
walkto(5129,5105);
walkto(5129,5085);
walkto(5110,5062);
walkto(5106,5043);
print("stashing");
walkto(5106, 5043);
walkto(5110, 5065);
walkto(5123, 5058);
delay(100);
NPCinteract(stash);
}
function getUnitByGID(gid)
{
item=getUnit(4);
if(item) do
{
if(item.gid==gid)
return item
} while(item.getNext());
return 0;
}
function selling()
{
sellarray = new Array();
sellitem = getUnit(4,null,1)
delay(100)
if (sellitem)
{
do {
sellarray.push(sellitem.gid);
}
while(sellitem.getNext(null,1));}
}
function getBoughtItem(item) {
//scanning for the new one
newitem = getUnit(4,null,1);
delay(100);
// If we have a item, check if it is in the old list
if (newitem) { do {
var new_item=true;
for (var x=0; x<sellarray.length; x+=1) {
if (sellarray[x]==newitem.gid) { new_item=false; }
}
if (new_item) { return newitem; }
} while (newitem.getNext(null,1)); }
return false;
} If someone know d2jsp well and wants to help, please do so. |
| | | |