Page 1 of 2
Inventory.lua ERROR
Posted: Sun Jan 17, 2010 7:45 am
by gr1ft3r
I keep on receiving this error:
inventory.lua:394: attempt to concatenate local 'durakey' <a nil value>
MM scans the inventory afterwards it should auto sell but the error popped out..
it was working perfectly before.. already tried to DL new MM and rom folder but still no luck
what do you think guys?
Re: Need Help with this ERROR Guys
Posted: Sun Jan 17, 2010 2:39 pm
by Administrator
The rules wrote:9. All thread titles must contain useful keywords. Titles such as "I need help!" aren't useful.
The rules wrote:11. Do not post screenshots of text errors. Really, it doesn't help.
Edit rom/classes/inventory.lua. Go to line 391, see this:
Code: Select all
local durakey = ITEM_TOOLTIP_DURABILITY[bot.ClientLanguage]; -- keyword to search for
Below this line, add:
Code: Select all
printf("Lang: %s, durakey: %s\n", tostring(bot.ClientLanguage), durakey);
Provide the results.
Re: Inventory.lua ERROR
Posted: Sun Jan 17, 2010 5:34 pm
by gr1ft3r
Here is what i did:
local duramax; -- durability max value (if found)
local durakey = ITEM_TOOLTIP_DURABILITY[bot.ClientLanguage]; -- keyword to search for
printf("Lang: %s, durakey: %s\n", tostring(bot.ClientLanguage), durakey);
and an error came up
inventory.lua:390: bad argument #2 to 'printf' <got nil>
Re: Inventory.lua ERROR
Posted: Sun Jan 17, 2010 5:36 pm
by Administrator
Try adding tostring() around durakey in that added line, as well.
Re: Inventory.lua ERROR
Posted: Sun Jan 17, 2010 6:16 pm
by gr1ft3r
printf("Lang: %s, durakey: %s\n", tostring(bot.ClientLanguage), tostring(durakey));
kindly check what i did if its correct coz i got an error
inventory.lua:394: attempt to concatenate local 'durakey' <a nil value>
Re: Inventory.lua ERROR
Posted: Sun Jan 17, 2010 6:24 pm
by Administrator
Code: Select all
printf("Lang: %s\n", tostring(bot.ClientLanguage));
printf("durakey: %s\n", tostring(durakey) or "nil");
Re: Inventory.lua ERROR
Posted: Sun Jan 17, 2010 9:38 pm
by gr1ft3r
Sir i'm still having the same problem..
inventory.lua:395: attempt to concatenate local 'durakey' <a nil value>
Re: Inventory.lua ERROR
Posted: Mon Jan 18, 2010 12:10 am
by Administrator
Forget about the error for now. Provide the output of the above change. It should look like this:
Lang: English
durakey: <something>
Re: Inventory.lua ERROR
Posted: Mon Jan 18, 2010 12:41 am
by gr1ft3r
Lang: PH
durakey: nil
that's what it says..
Re: Inventory.lua ERROR
Posted: Mon Jan 18, 2010 5:24 am
by Administrator
What is the 'Durability' text exactly as it appears in game for the PH version?
Edit rom/classes/item.lua, ~line 4. You'll see this:
Code: Select all
ITEM_TOOLTIP_DURABILITY = {
DE = "Haltbarkeit",
FR = "Structure",
ENEU = "Durability",
ENUS = "Durability"
};
Add an entry, like so:
Code: Select all
ITEM_TOOLTIP_DURABILITY = {
DE = "Haltbarkeit",
FR = "Structure",
ENEU = "Durability",
ENUS = "Durability",
PH = "Durability"
};
Except, you'll have to translate the 'Durability' text.
Re: Inventory.lua ERROR
Posted: Mon Jan 18, 2010 5:47 am
by gr1ft3r
Error solved!
Thank you so much Admin for looking into my problem.

Re: Inventory.lua ERROR
Posted: Mon Jan 18, 2010 3:47 pm
by Administrator
I still need to know what the 'Durability' text is so that I can provide it for others in future versions.
Re: Inventory.lua ERROR
Posted: Mon Jan 18, 2010 5:59 pm
by gr1ft3r
Sorry for the late reply.. i included PH = "Durability" in the item tool tip... because its not included.. Thanks again admin..
Re: Inventory.lua ERROR
Posted: Thu Jan 21, 2010 2:07 am
by hpkid2002
hi there, after look through this topic, my problem mostly solved but still had one minor problem: is it possible use Unicode in item.lua ? because when i tried fix it with Unicode, MM not recognize file item.lua. I need replace durakey with my language VN like this : Äá»™ bá»n ? thank you
Re: Inventory.lua ERROR
Posted: Thu Jan 21, 2010 3:07 am
by Administrator
You must use the escape codes. For example, to put a 'ü' character, you put "\252" in instead of that character. Good luck finding the escape codes for all those characters. That's an exercise left to you.
Re: Inventory.lua ERROR
Posted: Thu Jan 21, 2010 4:11 am
by hpkid2002
hi there,
can you tell me more details about it ? I'm seem still confusing. because its still impossible for me to find character 2 byte with ascii =(
Re: Inventory.lua ERROR
Posted: Thu Jan 21, 2010 5:07 pm
by Administrator
Check rom/database/utf8_ascii.xml. You'll see the Russian characters at the bottom.
Code: Select all
<utf8_ascii utf8_1="208" utf8_2="144" ascii="192" dos_replace="128" />
This character (Whatever it is) can be represented by: "\208\144"
You'll have to search Google for your own list of what all these codes are. x_art might be able to help (I think he was the one that submitted the Russian character information for the bot -- might have him confused with someone else).
You can also use the
Extended ASCII chart to use extended ASCII where applicable. For example,

is (decimal) 170. Use "\170" to represent this character.
Re: Inventory.lua ERROR
Posted: Fri Jan 22, 2010 3:12 am
by hpkid2002
can you tell me more about this ? example how convert and decode it ?
example:
<utf8_ascii utf8_1="208" utf8_2="144" ascii="192" dos_replace="128" />
this code, what rules for combine and what mean ascii and dos_replace ?"Durability" in my language "Äá»™ bá»n" it converted to :"272 7897 32 98 7873 110" (Decimal code points) and "\0110 \1ed9 b\1ec1 n" (CSS escapes). I'm not sure how can use utf8_ascii like this to represent for bot to understand "Durability". Now I'm kind of stuck.
btw when i tried use "\208\144" in item.lua, it known as "А" in games client or something ?
Re: Inventory.lua ERROR
Posted: Fri Jan 22, 2010 7:26 pm
by Administrator
To be honest, I'm not entirely sure how it should all work (as I'm sure you've noticed by now). Still figuring that all out myself. From my understanding, though, Lua is capable of holding Lua strings, but can't do any real work with them (string comparisons might work, but concatenation, length, etc. is probably broken).
For this reason, I'm not sure if putting Unicode characters in a string while using UTF-8 formatting works, but it's worth a try. If you don't have Notepad++ already, download it (it's free). Use Notepad++ to edit the file. First, go to Format->Encode in UTF-8 without BOM (it is important that you use
without BOM). Now, just type in "Äá»™ bá»n" as-is where needed. Try it.
I made a short script that will dump the decimal values for a given string. Remember to format this as UTF-8 without BOM.
Code: Select all
function main()
local str = "Äá»™ bá»n";
printf(str .. "\n");
for i = 1,string.len(str) do
printf("%d\n", string.byte(str, i));
end
end
startMacro(main, true);
You'll see that it prints jibberish for the string (again, because Lua doesn't handle Unicode well), but it seems to be able to get the bytes OK. I got:
Code: Select all
196
144
225
187
153
32
98
225
187
129
110
So, "\196\144\225\187\153\32\98\225\187\129\110" should work.
Re: Inventory.lua ERROR
Posted: Fri Jan 22, 2010 8:20 pm
by hpkid2002
awesome its working like charm now, and plus some experience in ascii code lol
Now i can convert code all my need. thank you for helping, great working.
btw it's still not recognize in profiles.xml, example
<option name="INV_AUTOSELL_IGNORE" value="III,health,mana,\196\144\195\161" />
as "\196\144\195\161" (Äá) is my runes name and bot still sell it. should i use something else for it to work ?