Inventory.lua ERROR
Inventory.lua ERROR
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?
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?
Last edited by gr1ft3r on Sun Jan 17, 2010 5:28 pm, edited 2 times in total.
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Need Help with this ERROR Guys
The rules wrote:9. All thread titles must contain useful keywords. Titles such as "I need help!" aren't useful.
Edit rom/classes/inventory.lua. Go to line 391, see this:The rules wrote:11. Do not post screenshots of text errors. Really, it doesn't help.
Code: Select all
local durakey = ITEM_TOOLTIP_DURABILITY[bot.ClientLanguage]; -- keyword to search for
Code: Select all
printf("Lang: %s, durakey: %s\n", tostring(bot.ClientLanguage), durakey);
Re: Inventory.lua ERROR
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>
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>
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
Try adding tostring() around durakey in that added line, as well.
Re: Inventory.lua ERROR
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>
kindly check what i did if its correct coz i got an error
inventory.lua:394: attempt to concatenate local 'durakey' <a nil value>
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
Code: Select all
printf("Lang: %s\n", tostring(bot.ClientLanguage));
printf("durakey: %s\n", tostring(durakey) or "nil");
Re: Inventory.lua ERROR
Sir i'm still having the same problem..
inventory.lua:395: attempt to concatenate local 'durakey' <a nil value>
inventory.lua:395: attempt to concatenate local 'durakey' <a nil value>
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
Forget about the error for now. Provide the output of the above change. It should look like this:
Lang: English
durakey: <something>
Lang: English
durakey: <something>
Re: Inventory.lua ERROR
Lang: PH
durakey: nil
that's what it says..
durakey: nil
that's what it says..
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
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:
Add an entry, like so:
Except, you'll have to translate the 'Durability' text.
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"
};
Code: Select all
ITEM_TOOLTIP_DURABILITY = {
DE = "Haltbarkeit",
FR = "Structure",
ENEU = "Durability",
ENUS = "Durability",
PH = "Durability"
};
Re: Inventory.lua ERROR
Error solved!
Thank you so much Admin for looking into my problem.
Thank you so much Admin for looking into my problem.
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
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
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
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
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
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
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 =(
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 =(
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
Check rom/database/utf8_ascii.xml. You'll see the Russian characters at the bottom.
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.
Code: Select all
<utf8_ascii utf8_1="208" utf8_2="144" ascii="192" dos_replace="128" />
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
can you tell me more about this ? example how convert and decode it ?
example:
btw when i tried use "\208\144" in item.lua, it known as "А" in games client or something ?
example:
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.<utf8_ascii utf8_1="208" utf8_2="144" ascii="192" dos_replace="128" />
btw when i tried use "\208\144" in item.lua, it known as "А" in games client or something ?
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Inventory.lua ERROR
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.
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:
So, "\196\144\225\187\153\32\98\225\187\129\110" should work.
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);
Code: Select all
196
144
225
187
153
32
98
225
187
129
110
Re: Inventory.lua ERROR
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
Now i can convert code all my need. thank you for helping, great working.
btw it's still not recognize in profiles.xml, example
as "\196\144\195\161" (Äá) is my runes name and bot still sell it. should i use something else for it to work ?<option name="INV_AUTOSELL_IGNORE" value="III,health,mana,\196\144\195\161" />
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot] and 0 guests