Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.
Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
-
zer0
- Posts: 213
- Joined: Sat Feb 16, 2008 11:55 pm
#1
Post
by zer0 » Mon Feb 23, 2009 7:10 am
I added a mod to change parsed hex strings to a number. Handy if you want to put hexadecimal as a value.
For example:
Code: Select all
<config name="mem_offset">0x0f00</config>
Becomes 1024.
In XML.lua:
Here was the mod.
Code: Select all
-- convert hex string to number.
if( string.find(data, "^(0x%x+)$") ~= nil) then
--print ("data: ", data)
return tonumber(data:sub(3), 16);
end
Added to the implicitCast function like so:
Code: Select all
function implicitCast(data)
if( data == "true" ) then
return true; end;
if( data == "false" ) then
return false; end;
if( string.find(data, "[^%.?0-9+]") == nil ) then
return tonumber(data);
end
-- convert hex string to number.
if( string.find(data, "^(0x%x+)$") ~= nil) then
--print ("data: ", data)
return tonumber(data:sub(3), 16);
end
return data;
end
I have several uses for it so I think it's pretty useful to include it in the XML lua parser.
-
Administrator
- Site Admin
- Posts: 5313
- Joined: Sat Jan 05, 2008 4:21 pm
#2
Post
by Administrator » Mon Feb 23, 2009 2:25 pm
Good idea, I've just added this to MicroMacro 1.0, and it will appear in the next beta or full release. Thanks.
-
zer0
- Posts: 213
- Joined: Sat Feb 16, 2008 11:55 pm
#3
Post
by zer0 » Tue Feb 24, 2009 6:48 am
Hehe, awesome thanks Elv.
Who is online
Users browsing this forum: Google [Bot] and 0 guests