Rev 578 - getpos not work

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
zbynio
Posts: 36
Joined: Thu Feb 04, 2010 8:16 am
Location: POLAND

Rev 578 - getpos not work

#1 Post by zbynio » Mon Feb 21, 2011 6:08 pm

Hi

getpos.bat return this message:

scripts/rom/classes/pawn.lua:394: attempt to call global 'GetIdName' (a nil value)

Please fix it OK? ^^

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rev 578 - getpos not work

#2 Post by rock5 » Tue Feb 22, 2011 2:00 am

Sorry, I was just waiting for an answer to another post before committing a fix. Hopefully it wont be much longer.

All it needs is

Code: Select all

include("classes/memorytable.lua");
at the top of the file.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Germangold
Posts: 276
Joined: Thu Oct 22, 2009 3:58 am

Re: Rev 578 - getpos not work

#3 Post by Germangold » Tue Feb 22, 2011 4:35 pm

Code: Select all

Table not found for ID: 500548
Table not found for ID: 500940
Table not found for ID: 507218
Table not found for ID: 500517
Table not found for ID: 507217
Table not found for ID: 500479
Table not found for ID: 500478
Table not found for ID: 504225
Table not found for ID: 501387
Table not found for ID: 500535
Table not found for ID: 501004
Table not found for ID: 502026
Table not found for ID: 500548
Table not found for ID: 500940
Table not found for ID: 507218
Table not found for ID: 500517
Table not found for ID: 507217
Table not found for ID: 500479
Table not found for ID: 500478
Table not found for ID: 504225
Table not found for ID: 501387
Table not found for ID: 500535
Table not found for ID: 501004
Table not found for ID: 500548
seems that adress for buff is not working anymore
all my chars buffing all the time :)

found a solution
log out close client
rom\macrofix
charname

relogg
working fine for all my chars again

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rev 578 - getpos not work

#4 Post by rock5 » Tue Feb 22, 2011 6:27 pm

'macrofix'? That's not part of the bot. Where did you get it? What does it do?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Germangold
Posts: 276
Joined: Thu Oct 22, 2009 3:58 am

Re: Rev 578 - getpos not work

#5 Post by Germangold » Tue Feb 22, 2011 7:33 pm

i dont know
its basicly with in svn
macrofix.lua

Code: Select all

--[[ MACRO FORMAT:

(8 byte head)
	(4 byte size of MACRO DATA [currently 1288])(4 byte NUM OF MACROS)

(1288 byte MACRO DATA)
	LOOP:
		(4 byte INDEX[0-55])(4byte ICON)
		(256 byte UNKNOWN)
		(256 byte MACRO TEXT)
		(768 byte PADDING?)
	ENDLOOP
--]]

local MACRO_SIZE = 1288;
local MACRO_COUNT = 56;

local MACRO_UNKNOWNSIZE = 0x100;
local MACRO_TEXTSIZE = 0x100; -- Size including NULL terminator
local MACRO_PADDINGSIZE = 0x300;

local MACRO_ICONMAX = 60;
local MACRO_NULLICON = 0XFFFFFFFF;


local userprofilePath = os.getenv("USERPROFILE");
local documentPaths = {
	userprofilePath .. "\\My Documents\\" .. "Runes of Magic", -- English
	userprofilePath .. "\\Eigene Dateien\\" .. "Runes of Magic", -- German
	userprofilePath .. "\\Mes Documents\\" .. "Runes of Magic", -- French
	userprofilePath .. "\\Omat tiedostot\\" .. "Runes of Magic", -- Finish
	userprofilePath .. "\\Belgelerim\\" .. "Runes of Magic", -- Turkish
	userprofilePath .. "\\Mina Dokument\\" .. "Runes of Magic", -- Swedish
	userprofilePath .. "\\Dokumenter\\" .. "Runes of Magic", -- Danish
	userprofilePath .. "\\Documenti\\" .. "Runes of Magic", -- Italian
	userprofilePath .. "\\Mijn documenten\\" .. "Runes of Magic", -- Dutch
	userprofilePath .. "\\Moje dokumenty\\" .. "Runes of Magic", -- Polish
	userprofilePath .. "\\Mis documentos\\" .. "Runes of Magic", -- Spanish
};

-- Select the first path that exists
function findMacroBsd(charName)
	for i,v in pairs(documentPaths) do
		if( string.sub(v, -1 ) ~= "\\" and string.sub(v, -1 ) ~= "/" ) then
			v = v .. "\\"; -- Append the trailing backslash if necessary.
		end

		local filename = v .. charName .. "/Macro.bsd";
		if( fileExists(filename) ) then
			return filename;
		end
	end

	return nil;
end

-- Convert a Lua number to 4 bytes
function intToBytes(int)
	--int = tonumber( string.format("%u", int), 10);

	local a,b,c,d = math.mod(int, 256),
		math.mod(int, 65536) / 256,
		math.mod(int, 16777216) / 65536,
		int / 16777216;

	-- Some weird Lua bug with unsigned ints...
	-- It pretends it's positive, but will cause
	-- errors for being negitive in some functions (ie. string.char)
	-- This is a hackish work-around.
	if( a < 0 )		then a = math.max(a, 0);	end;
	if( a > 255 )	then a = math.min(a, 255);	end;
	if( b < 0 )		then b = math.max(b, 0);	end;
	if( b > 255 )	then b = math.min(b, 255);	end;
	if( c < 0 )		then c = math.max(c, 0);	end;
	if( c > 255 )	then c = math.min(c, 255);	end;
	if( d < 0 )		then d = math.max(d, 0);	end;
	if( d > 255 )	then d = math.min(d, 255);	end;

	return string.char(a, b, c, d);
end

function bytesToInt(a, b, c, d)
	return tonumber( string.format("%02x%02x%02x%02x", d, c, b, a), 16);
end

local macroData;
function initializeMacroData()
	macroData = {};

	for i = 1,MACRO_COUNT do
		macroData[i - 1] = {
			["icon"] = 		intToBytes(MACRO_NULLICON);
			["unknown"] =	string.rep( string.char(0x0), MACRO_UNKNOWNSIZE );
			["text"] = 		string.rep( string.char(0x0), MACRO_TEXTSIZE );
			["padding"] =	string.rep( string.char(0x0), MACRO_PADDINGSIZE );
		};
	end
end

function readMacroData(fname)
	local infile = io.open(fname, "rb");

	-- Read (but discard) the header; assume our own values
	--MACRO_SIZE = bytesToInt(string.byte(infile:read(4), 1, 4));
	infile:read(4); infile:read(4);

	for i = 1,MACRO_COUNT do
		local index = i - 1;
		local icon, unknown, text, padding;

		-- Read (and discard) index
		infile:read(4);

		-- Read icon
		icon = bytesToInt(string.byte(infile:read(4), 1, 4));

		-- Force it to a valid value
		if( icon ~= MACRO_NULLICON ) then
			icon = math.min(icon, MACRO_ICONMAX);
			icon = math.max(icon, 0);
		end

		-- Read (and discard) UNKNOWN data
		infile:read(MACRO_UNKNOWNSIZE);
		unknown = string.rep(string.char(0x0), MACRO_UNKNOWNSIZE);

		-- Read macro text
		text = infile:read(MACRO_TEXTSIZE);

		-- Force a NULL terminator
		text = string.sub(text, 1, text:len()-1) .. string.char(0x0);

		-- Read (and discard) padding
		infile:read(MACRO_PADDINGSIZE);
		padding = string.rep(string.char(0x0), MACRO_PADDINGSIZE);


		macroData[index].icon = icon;
		macroData[index].unknown = unknown;
		macroData[index].text = text;
		macroData[index].padding = padding;
	end

	infile:close();
end

function writeMacroData(fname)
	local outfile = io.open(fname, "wb");

	-- Write the header
	outfile:write( intToBytes(MACRO_SIZE) );
	outfile:write( intToBytes(MACRO_COUNT) );

	-- Write each macro
	for i = 1,MACRO_COUNT do
		local index = i - 1;
		outfile:write( intToBytes(i - 1) ); -- Write index
		outfile:write( intToBytes(macroData[index].icon) );

		outfile:write( macroData[index].unknown );
		outfile:write( macroData[index].text );
		outfile:write( macroData[index].padding );
	end

	outfile:close();
end



-- Prompt for character name
local charName, fname;
cprintf(cli.red, "MAKE SURE YOU ARE LOGGED OFF BEFORE RUNNING THIS SCRIPT!\n");
printf("Please input the character's name.\n>");
charName = string.gsub(io.read("*l"), "([%w%s%p]+)\n", "%0");
printf("Char name: \'%s\'\n", charName);

fname = findMacroBsd(charName);
if( fname == nil ) then
	printf("We were unable to find your Macro.bsd file.\n" ..
		"Try manually deleting Macro.bsd from My Documents/CharacterName/Macro.bsd");
else
	initializeMacroData();
	readMacroData(fname);
	writeMacroData("Macro.bsd");
	printf("Macro.bsd file rewritten. You can log in now.\n");
end

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rev 578 - getpos not work

#6 Post by rock5 » Tue Feb 22, 2011 7:56 pm

My SVN doesn't have it. Look at the icon next to it. If it's green (or red) it's part of SVN. If it has a blue icon, it's unversioned and not part of the bot. Maybe it was included from wherever you originally downloaded the bot from or maybe you added it at some time in the past.

Anyway, as I suspected, it looks like it repairs a corrupt macro.bsd which it cool. Saves you loosing all your macros if you have to delete it because it's corrupt. It would be worth adding to the bot if we knew where it's from.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: Rev 578 - getpos not work

#7 Post by JackBlonder » Wed Feb 23, 2011 1:56 am


User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rev 578 - getpos not work

#8 Post by rock5 » Wed Feb 23, 2011 4:28 am

Ah. I wonder why he didn't add it to the bot. I think it would be worth adding.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

zbynio
Posts: 36
Joined: Thu Feb 04, 2010 8:16 am
Location: POLAND

Re: Rev 578 - getpos not work

#9 Post by zbynio » Fri Feb 25, 2011 8:07 pm

rock5 wrote:Sorry, I was just waiting for an answer to another post before committing a fix. Hopefully it wont be much longer.

All it needs is

Code: Select all

include("classes/memorytable.lua");
at the top of the file.

thanx - all ok

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests