Item Check for Dailyquests
Item Check for Dailyquests
Can the bot handle a itemcheck? Where i have to include it?
I want to write a Waypointfile for the Dailyquests and so i need the item check for the Fungi or whe Wolfs at the Pioneers.
Would be nice if you could help me.
I want to write a Waypointfile for the Dailyquests and so i need the item check for the Fungi or whe Wolfs at the Pioneers.
Would be nice if you could help me.
- Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Item Check for Dailyquests
Not at this time, no. Someone would need to find static pointers to inventory slots first. I actually haven't bothered doing this myself, so I'm not sure how it is structured.
Re: Item Check for Dailyquests
okay i have writen a working ItemInventoryscan where u can search the inventory for a itemid.
Now is my question can i write an Fightvariable for each mob?
like
it would be better to do it with each own Variable for the Dailyquests and itemscan.
TheRedVex
Now is my question can i write an Fightvariable for each mob?
like
Code: Select all
fights.fungi
fights.wolfs
...
TheRedVex
Re: Item Check for Dailyquests
care to share the code?TheRedVex wrote:okay i have writen a working ItemInventoryscan where u can search the inventory for a itemid.
Now is my question can i write an Fightvariable for each mob?
likeit would be better to do it with each own Variable for the Dailyquests and itemscan.Code: Select all
fights.fungi fights.wolfs ...
TheRedVex
Re: Item Check for Dailyquests
if the codes with fungi and wolfs ... are find out i would like to share it yesdroppen wrote:care to share the code?TheRedVex wrote:okay i have writen a working ItemInventoryscan where u can search the inventory for a itemid.
Now is my question can i write an Fightvariable for each mob?
likeit would be better to do it with each own Variable for the Dailyquests and itemscan.Code: Select all
fights.fungi fights.wolfs ...
TheRedVex
Re: Item Check for Dailyquests
okay i´ve got it. here is my Code
this is the advanced killingfunction
add this to the pawn.lua like this
and then add this to the end of the fightfunction of player.lua
and comment the clearTarget line under Self:loot();
add this to the end of the Player.lua
add this to the adresses.lua
you will not die if you thank me for that.
this is the advanced killingfunction
add this to the pawn.lua like this
Code: Select all
CPawn = class(function (self, ptr)
self.Address = ptr;
self.Name = "<UNKNOWN>";
self.Id = 0;
self.Type = PT_NONE;
self.Guild = "<UNKNOWN>";
self.Level = 1;
self.Level2 = 1;
self.HP = 1000;
self.MaxHP = 1000;
self.MP = 1000;
self.MaxMP = 1000;
self.MP2 = 1000;
self.MaxMP2 = 1000;
self.X = 0.0;
self.Y = 0.0;
self.Z = 0.0;
self.TargetPtr = 0;
self.Direction = 0.0;
self.Attackable = false;
self.Alive = true;
-- Directed more at player, but may be changed later.
self.Battling = false; -- The actual "in combat" flag.
self.Fighting = false; -- Internal use, does not depend on the client's battle flag
self.Casting = false;
self.Mana = 0;
self.MaxMana = 0;
self.Rage = 0;
self.MaxRage = 0;
self.Energy = 0;
self.MaxEnergy = 0;
self.Concentration = 0;
self.MaxConcentration = 0;
self.PotionLastUseTime = 0;
self.Returning = false; -- Whether following the return path, or regular waypoints
self.BotStartTime = os.time(); -- Records when the bot was started.
self.BotStartTime_nr = 0; -- Records when the bot was started, will not return at pause
self.Unstick_counter = 0; -- counts unstick tries, resets if waypoint reached
self.Success_waypoints = 0; -- count consecutively successfull reached waypoints
self.Cast_to_target = 0; -- count casts to our enemy target
self.LastAggroTimout = 0; -- remeber last time we wait in vain for an aggro mob
self.Sleeping = false; -- sleep mode with fight back if attacked
self.Sleeping_time = 0; -- counts the sleeping time
self.Fights = 0; -- counts the fights
self.Death_counter = 0; -- counts deaths / automatic reanimation
self.MP_counter = 0; -- counts use of mana potions
self.HP_counter = 0; -- counts use of HP potions
self.Current_waypoint_type = WPT_NORMAL; -- remember current waypoint type global
self.Last_ignore_target_ptr = 0; -- last target to ignore
self.Last_ignore_target_time = 0; -- last target to ignore
self.lastHitTime = 0; -- last time the HP of the target changed
self.ranged_pull = false; -- ranged pull phase active
self.free_field1 = nil; -- free field for user use
self.free_field2 = nil; -- free field for user use
self.free_field3 = nil; -- free field for user use
self.free_counter1 = 0; -- free counter for user use
self.free_counter2 = 0; -- free counter for user use
self.free_counter3 = 0; -- free counter for user use
self.free_flag1 = false; -- free flag for user use
self.free_flag2 = false; -- free flag for user use
self.free_flag3 = false; -- free flag for user use
------------------ New attach for specific Mobkilling --------------------------
--------------------------------------------------------------------------------
self.mobs = {};
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
if( self.Address ~= 0 and self.Address ~= nil ) then self:update(); end
end
);
Code: Select all
------------------ New attach for specific Mobkilling --------------------------
--------------------------------------------------------------------------------
local mobid = string.format("%s",target.Name);
if(self.mobs[mobid] == nil) then
self.mobs[mobid] = 0
end
self.mobs[mobid] = self.mobs[mobid] + 1
cprintf(cli.lightblue, "%s kills : %s\n",mobid,self.mobs[mobid]);
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
self.Fighting = false;
self:clearTarget();
add this to the end of the Player.lua
Code: Select all
function CPlayer:ScanForItem(itemid)
local item;
local anzahl;
local slot;
local gesamt = 0;
for i=0, 29 do
slot = i + 1
item = memoryReadInt(getProc(), Inv[i]);
if(item == itemid) then
anzahl = memoryReadInt(getProc(), Anzahl[i]);
gesamt = anzahl + gesamt
cprintf(cli.yellow,"Slot %s: %sx %s\n",slot,anzahl,item);
end
end
if(gesamt >=1) then
cprintf(cli.yellow,"Gesamt %s: %sx\n",itemid,gesamt);
return gesamt
else
return 0
end
end
Code: Select all
Inv = {
[0] = 0x008EEB78,
[1] = 0x008EEB38,
[2] = 0x008EED58,
[3] = 0x008EEAB0,
[4] = 0x008EE7C0,
[5] = 0x008EEAF0,
[6] = 0x008EE5E4,
[7] = 0x008EE9E0,
[8] = 0x008EE5A0,
[9] = 0x008EE804,
[10] = 0x008EE848,
[11] = 0x008EE890,
[12] = 0x008EE8D0,
[13] = 0x008EE918,
[14] = 0x008EE958,
[15] = 0x008EE9A0,
[16] = 0x008EE628,
[17] = 0x008EEA28,
[18] = 0x008EEA68,
[19] = 0x008EE670,
[20] = 0x008EE6B0,
[21] = 0x008EE6F8,
[22] = 0x008EE738,
[23] = 0x008EEBC0,
[24] = 0x008EEC00,
[25] = 0x008EEC48,
[26] = 0x008EEC88,
[27] = 0x008EECD0,
[28] = 0x008EED10,
[29] = 0x008EE780,
};
Anzahl = {
[0] = 0x008EEB88,
[1] = 0x008EEB44,
[2] = 0x008EED64,
[3] = 0x008EEABC,
[4] = 0x008EE5F4,
[5] = 0x008EEB00,
[6] = 0x008EE5F4,
[7] = 0x008EE9F0,
[8] = 0x008EE5B0,
[9] = 0x008EE814,
[10] = 0x008EE858,
[11] = 0x008EE89C,
[12] = 0x008EE8E0,
[13] = 0x008EE924,
[14] = 0x008EE968,
[15] = 0x008EE9AC,
[16] = 0x008EE638,
[17] = 0x008EEA34,
[18] = 0x008EEA78,
[19] = 0x008EE67C,
[20] = 0x008EE6C0,
[21] = 0x008EE704,
[22] = 0x008EE748,
[23] = 0x008EEBCC,
[24] = 0x008EEC10,
[25] = 0x008EEC54,
[26] = 0x008EEC98,
[27] = 0x008EECDC,
[28] = 0x008EED20,
[29] = 0x008EE78C,
};
Re: Item Check for Dailyquests
Wow! nice coding there! The item checking is now possible though too. I made this function for you
Usage: it returns the total number of any one item in your backpack.
Thanks for the address list!
Code: Select all
function countItemTotal(itemName)
local itemTotal = 0;
for i = 1, 60, 1 do
local bagid, icon, name, itemCount = RoMScript("GetBagItemInfo("..i..");");
if (itemName == name) then
itemTotal = itemTotal + itemCount;
end
end
return itemTotal;
end
Code: Select all
countItemTotal("Barbarian Herbs")
Thanks for the address list!
Re: Item Check for Dailyquests
ive got it allready
but the adresslist is only for the first 30 inventarslots
there u add the itemid
EDIT: CODE tag added.
but the adresslist is only for the first 30 inventarslots
Code: Select all
function CPlayer:ScanForItem(itemid)
local item;
local anzahl;
local slot;
local gesamt = 0;
for i=0, 29 do
slot = i + 1
item = memoryReadInt(getProc(), Inv[i]);
if(item == itemid) then
anzahl = memoryReadInt(getProc(), Anzahl[i]);
gesamt = anzahl + gesamt
cprintf(cli.yellow,"Slot %s: %sx %s\n",slot,anzahl,item);
end
end
if(gesamt >=1) then
cprintf(cli.yellow,"Gesamt %s: %sx\n",itemid,gesamt);
return gesamt
else
return 0
end
end
EDIT: CODE tag added.
Re: Item Check for Dailyquests
Yep, impressive.
Re: Item Check for Dailyquests
ItemCount function doesn´t work
Tried this :
MicroMacro writes this into the RoM macro :: a={GetBagItemInfo(k);}
So the coders must find a way to write what the variable holds instead of writing the variable name.
Tried this :
Code: Select all
for k = 1, 60 , 1 do
local bagid, icon, name, itemCount = RoMScript("GetBagItemInfo(k);");
end
So the coders must find a way to write what the variable holds instead of writing the variable name.
- Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Item Check for Dailyquests
String concatenation.master121 wrote:ItemCount function doesn´t work
Tried this :MicroMacro writes this into the RoM macro :: a={GetBagItemInfo(k);}Code: Select all
for k = 1, 60 , 1 do local bagid, icon, name, itemCount = RoMScript("GetBagItemInfo(k);"); end
So the coders must find a way to write what the variable holds instead of writing the variable name.
Code: Select all
local bagid, icon, name, itemCount = RoMScript("GetBagItemInfo(" .. k .. ");");
Re: Item Check for Dailyquests
I get this error:
functions.lua:371 bad argument #1 to 'char' (invalid value)
functions.lua:371 bad argument #1 to 'char' (invalid value)
- Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Item Check for Dailyquests
Debug it by placing a print statement right above that line. What is the value of 'byte' when it gives that error?
Re: Item Check for Dailyquests
Code: Select all
for k = 1, 60, 1 do
local bagid, icon, name, itemCount = RoMScript("GetBagItemInfo(" .. k .. ");");
end
byte = plenty of numbers with a negative number at the end
Without loop
byte = plenty of numbers WITHOUT a negative number at the end
// So it has to do something with the negative number and the loop ... but what ?
readsz = readsz .. string.char(byte); causes the error
Code: Select all
string.char(i1, i2, ...)
Generate a string representing the character codes passed as arguments. Numerical codes are not necessarily portable across platforms.
> = string.char(65,66,67)
ABC
> = string.char() -- empty string
// But why is there a negativ number ?
- Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Item Check for Dailyquests
What exactly is the negitive number that it dies on? What is the number directly before it?
I assume it's a problem with signed vs. unsigned on line 356. Change memoryReadByte() to memoryReadUByte() and see if that works.
I assume it's a problem with signed vs. unsigned on line 356. Change memoryReadByte() to memoryReadUByte() and see if that works.
Re: Item Check for Dailyquests
It works with memoryReadUByte()
Thanks champ
Thanks champ
Re: Item Check for Dailyquests
I added the player.mobs array to SVN 213. Kills will now be counted per target name.TheRedVex wrote:this is the advanced killingfunction
add this to the pawn.lua like thisCode: Select all
CPawn = class(function (self, ptr) ... ------------------ New attach for specific Mobkilling -------------------------- -------------------------------------------------------------------------------- self.mobs = {}; -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- if( self.Address ~= 0 and self.Address ~= nil ) then self:update(); end end );
@TheRedVex: THX for your help and suggestions.
The RoM Bot Online Wiki needs your help!
Who is online
Users browsing this forum: No registered users and 46 guests