Inventory.lua ERROR

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
gr1ft3r
Posts: 12
Joined: Sat Jan 16, 2010 11:08 am

Inventory.lua ERROR

#1 Post by gr1ft3r » Sun Jan 17, 2010 7:45 am

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?
Last edited by gr1ft3r on Sun Jan 17, 2010 5:28 pm, edited 2 times in total.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Need Help with this ERROR Guys

#2 Post by Administrator » Sun Jan 17, 2010 2:39 pm

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.

gr1ft3r
Posts: 12
Joined: Sat Jan 16, 2010 11:08 am

Re: Inventory.lua ERROR

#3 Post by gr1ft3r » Sun Jan 17, 2010 5:34 pm

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>

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#4 Post by Administrator » Sun Jan 17, 2010 5:36 pm

Try adding tostring() around durakey in that added line, as well.

gr1ft3r
Posts: 12
Joined: Sat Jan 16, 2010 11:08 am

Re: Inventory.lua ERROR

#5 Post by gr1ft3r » Sun Jan 17, 2010 6:16 pm

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>

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#6 Post by Administrator » Sun Jan 17, 2010 6:24 pm

Code: Select all

printf("Lang: %s\n", tostring(bot.ClientLanguage));
printf("durakey: %s\n", tostring(durakey) or "nil");

gr1ft3r
Posts: 12
Joined: Sat Jan 16, 2010 11:08 am

Re: Inventory.lua ERROR

#7 Post by gr1ft3r » Sun Jan 17, 2010 9:38 pm

Sir i'm still having the same problem..
inventory.lua:395: attempt to concatenate local 'durakey' <a nil value>

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#8 Post by Administrator » Mon Jan 18, 2010 12:10 am

Forget about the error for now. Provide the output of the above change. It should look like this:
Lang: English
durakey: <something>

gr1ft3r
Posts: 12
Joined: Sat Jan 16, 2010 11:08 am

Re: Inventory.lua ERROR

#9 Post by gr1ft3r » Mon Jan 18, 2010 12:41 am

Lang: PH
durakey: nil

that's what it says..

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#10 Post by Administrator » Mon Jan 18, 2010 5:24 am

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.

gr1ft3r
Posts: 12
Joined: Sat Jan 16, 2010 11:08 am

Re: Inventory.lua ERROR

#11 Post by gr1ft3r » Mon Jan 18, 2010 5:47 am

Error solved!
Thank you so much Admin for looking into my problem. :D

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#12 Post by Administrator » Mon Jan 18, 2010 3:47 pm

I still need to know what the 'Durability' text is so that I can provide it for others in future versions.

gr1ft3r
Posts: 12
Joined: Sat Jan 16, 2010 11:08 am

Re: Inventory.lua ERROR

#13 Post by gr1ft3r » Mon Jan 18, 2010 5:59 pm

Sorry for the late reply.. i included PH = "Durability" in the item tool tip... because its not included.. Thanks again admin..

hpkid2002
Posts: 8
Joined: Wed Jan 06, 2010 4:23 am

Re: Inventory.lua ERROR

#14 Post by hpkid2002 » Thu Jan 21, 2010 2:07 am

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

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#15 Post by Administrator » Thu Jan 21, 2010 3:07 am

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.

hpkid2002
Posts: 8
Joined: Wed Jan 06, 2010 4:23 am

Re: Inventory.lua ERROR

#16 Post by hpkid2002 » Thu Jan 21, 2010 4:11 am

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 =(

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#17 Post by Administrator » Thu Jan 21, 2010 5:07 pm

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, Image is (decimal) 170. Use "\170" to represent this character.

hpkid2002
Posts: 8
Joined: Wed Jan 06, 2010 4:23 am

Re: Inventory.lua ERROR

#18 Post by hpkid2002 » Fri Jan 22, 2010 3:12 am

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 ?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Inventory.lua ERROR

#19 Post by Administrator » Fri Jan 22, 2010 7:26 pm

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.

hpkid2002
Posts: 8
Joined: Wed Jan 06, 2010 4:23 am

Re: Inventory.lua ERROR

#20 Post by hpkid2002 » Fri Jan 22, 2010 8:20 pm

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 ?

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 1 guest