Log in

View Full Version : mod code question


skycrow
12-03-2012, 05:34 PM
I ask the question for certain person .

He is developing a mod .
http://forum.1cpublishing.eu/showthread.php?t=36243



But he encountered a error (attached pic) and a messenger "msg_gold_is_found_01" in-game.Does anyone know how to fix the

error and can the chests.lua code be improved ?

For i can't find WotN's mod sub-forum, so i open the thread here and there seems to higher popularity here.:)



Btw,the mod refers to a previous mod here but i don't know that original mod's name.

saroumana
12-03-2012, 07:11 PM
Without the code we can't help you. The message is clear, there are an error on line 85, now without the function...;)

skycrow
12-03-2012, 07:22 PM
Without the code we can't help you. The message is clear, there are an error on line 85, now without the function...;)

I guess the error should occur in chests.lua in the mod .

He seemed to mention he wrote the chests.lua in the mod with boxes.lua and addon_pet.lua .


Is the problem as simple as what you replied ?Ok ,i will tell him.Thx.

saroumana
12-03-2012, 09:18 PM
Simple ? Certainly not !

The problem occur in :

function gen_object_in_box_name(par)
-- äîñòóïíû ïåðåìåííûå:
-- object - òýã ïðåäìåòà
-- count - êîëè÷åñòâî âçÿòîãî
-- image
local cs = Logic.cur_lu_var("count")
local count = 0
if cs ~= nil then
count = tonumber( "0" .. cs )
end
if par == "image" then
return "<imb=" .. Logic.cur_lu_var("image") .. ">" --<br><label=itm_"..Logic.cur_lu_var("object").."_name>: "..tostring(count)
end
if par == "name" then
if count > 1 then
return "<label=itm_"..Logic.cur_lu_var("object").."_name>: "..tostring(count)
else
return "<label=itm_"..Logic.cur_lu_var("object").."_name>"
end
end
if count > 1 then
return "<br><imb=" .. Logic.cur_lu_var("image") .. "><br><label=itm_"..Logic.cur_lu_var("object").."_name>: "..tostring(count)
else
return "<br><imb=" .. Logic.cur_lu_var("image") .. "><br><label=itm_"..Logic.cur_lu_var("object").."_name>"
end
end

But he don't change this file, it's called from somewhere in his mod, and he must find where.

skycrow
12-05-2012, 05:38 AM
Saroumana,thanks for your explanation.


I seem to find the question ,and now i want to know whether it can be answered

or modified if anyone can reply again.



The mod has a purpose to get random items form dug chests in battlefield by

mixing boxes.lua with addon_pet.lua ,but it seems to the mod that random

items will cause certain error.

Reference to this thread:
http://forum.1cpublishing.eu/showthread.php?p=126406#post126406



Is it impossible to safely let dug chests in battlefield generate random

items due to some internal codes we can't modify ?

saroumana
12-05-2012, 05:54 PM
It crash at this line :


return "<br><imb=" .. Logic.cur_lu_var("image") .. "><br><label=itm_"..Logic.cur_lu_var("object").."_ name>"

Which mean some value are missing. Whether :

-image
-object (unlikely)
-name

I guest some objects (item ?) don't have the image field filled.