[TFS 1.2] Simple Crafting System.

OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,370
Solutions
6
Reaction score
533
I will rewrite this and upload tomorrow.
 

Lucas Primo

New Member
Joined
Oct 3, 2017
Messages
22
Solutions
1
Reaction score
2
Location
Brazil
my bad this post, @strutZ because after i tried and i saw the new script! Is working 100%, and the name is really necessary correct 100% to working.

Very Thankys! I'm new in otland, and the experience is nice, i hope i can contribute!
 

William Hughes

New Member
Joined
Oct 12, 2018
Messages
28
Reaction score
1
does anyone know how to add the creater name to this? so whoever crafts the item is written on the item after that
 

William Hughes

New Member
Joined
Oct 12, 2018
Messages
28
Reaction score
1
because the complicated method of giving the correct item generated by the modal window, adding

line 78 or so of crafting library
self:addItem(config.system[lastChoice].items[choice.id].itemID, config.system[lastChoice].items[choice.id].count)

adding...

self:doSetItemSpecialDescription(uid, description)

is giving me a lot of trouble. Anyone know the best way to do so?


--attempting to make the item read as follows

You see a rope
it weights 1.oz
it was crafted by (get player name)
 

Ramirow

Veteran OT User
Joined
Aug 22, 2009
Messages
554
Solutions
15
Reaction score
264
Location
Argentina
because the complicated method of giving the correct item generated by the modal window, adding

line 78 or so of crafting library
self:addItem(config.system[lastChoice].items[choice.id].itemID, config.system[lastChoice].items[choice.id].count)

adding...

self:doSetItemSpecialDescription(uid, description)

is giving me a lot of trouble. Anyone know the best way to do so?


--attempting to make the item read as follows

You see a rope
it weights 1.oz
it was crafted by (get player name)
Something like this should work:
Code:
craftedItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Created by "..player:getName()..".")
I don't know if it will work like this but you can try adding it at the end.
Code:
self:addItem(config.system[lastChoice].items[choice.id].itemID, config.system[lastChoice].items[choice.id].count):setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Created by "..player:getName()..".")
Or you can get the Item(UID) and then apply the description.
Code:
Item(UID):setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Created by "..player:getName()..".")
 

William Hughes

New Member
Joined
Oct 12, 2018
Messages
28
Reaction score
1
Something like this should work:
Code:
craftedItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Created by "..player:getName()..".")
I don't know if it will work like this but you can try adding it at the end.
Code:
self:addItem(config.system[lastChoice].items[choice.id].itemID, config.system[lastChoice].items[choice.id].count):setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Created by "..player:getName()..".")
Or you can get the Item(UID) and then apply the description.
Code:
Item(UID):setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Created by "..player:getName()..".")

1. Lua error on line, nil value when calling method 'Item'
2.Attempt to index global player a nil value - onto something! It at least shows a possible way I can fix that
3.Attempt to call method 'item' a nil value

Though none of these 3 directly worked I chose to try and nudge #2 along because it gave me more to work with as far as a possible fix.
Adjusting the
"Created by "..player:getName()..".")
to
"Created by "..self:getName()..".")
Worked!

Tested it with saving the description and all, seems to be working perfectly so thank you very much for the help with that problem!
Ramirow great work :D
 

Ramirow

Veteran OT User
Joined
Aug 22, 2009
Messages
554
Solutions
15
Reaction score
264
Location
Argentina
1. Lua error on line, nil value when calling method 'Item'
2.Attempt to index global player a nil value - onto something! It at least shows a possible way I can fix that
3.Attempt to call method 'item' a nil value

Though none of these 3 directly worked I chose to try and nudge #2 along because it gave me more to work with as far as a possible fix.
Adjusting the
"Created by "..player:getName()..".")
to
"Created by "..self:getName()..".")
Worked!

Tested it with saving the description and all, seems to be working perfectly so thank you very much for the help with that problem!
Ramirow great work :D
Glad you managed to sort it out n_n
Have a nice day!
 

hucke.ducke

Tibia the real rpg. <3
Joined
Jul 28, 2019
Messages
37
Reaction score
1
Location
Chile
Hello, i know its been a while since the script was posted but im getting this error on console.

The script works. Just having an issue with the details option. It doesnt close the window properly it just overlay the previous window.

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/modalwindowhelper.lua:eek:nModalWindow
data/lib/crafting.lua:48: attempt to index local 'choice' (a nil value)
stack traceback:
[C]: in function '__index'
data/lib/crafting.lua:48: in function 'callback'
data/creaturescripts/scripts/modalwindowhelper.lua:26: in function <data/creaturescripts/scripts/modalwindowhelper.lua:1>
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,370
Solutions
6
Reaction score
533
Hello, i know its been a while since the script was posted but im getting this error on console.

The script works. Just having an issue with the details option. It doesnt close the window properly it just overlay the previous window.

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/modalwindowhelper.lua:eek:nModalWindow
data/lib/crafting.lua:48: attempt to index local 'choice' (a nil value)
stack traceback:
[C]: in function '__index'
data/lib/crafting.lua:48: in function 'callback'
data/creaturescripts/scripts/modalwindowhelper.lua:26: in function <data/creaturescripts/scripts/modalwindowhelper.lua:1>
I will redo this script one day.. but from memory you bave to make sure you have your choices EXACTLY as it appears on your items.xml so all capitals etc.

if your items.xml has "Fire Sword", then your choice must also read "Fire Sword" not "fire sword".
 

Gamesert13

New Member
Joined
Sep 18, 2019
Messages
15
Reaction score
0
Hey if im click Details window is go close and i have this on console and i can make someone with this?
Code:
        [C]: in function 'capAll'
        data/lib/crafting.lua:55: in function 'callback'
        data/creaturescripts/scripts/modalwindowhelper.lua:26: in function <data/creaturescripts/scripts/modalwindowhelper.lua:1>
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,370
Solutions
6
Reaction score
533
Hey if im click Details window is go close and i have this on console and i can make someone with this?
Code:
        [C]: in function 'capAll'
        data/lib/crafting.lua:55: in function 'callback'
        data/creaturescripts/scripts/modalwindowhelper.lua:26: in function <data/creaturescripts/scripts/modalwindowhelper.lua:1>

Add this to your global.lua


Lua:
function capAll(str)
    local newStr = ""; wordSeparate = string.gmatch(str, "([^%s]+)")
    for v in wordSeparate do
        v = v:gsub("^%l", string.upper)
        if newStr ~= "" then
            newStr = newStr.." "..v
        else
            newStr = v
        end
    end
    return newStr
end
 

genadilson

New Member
Joined
Jun 21, 2019
Messages
1
Reaction score
0
alguém poderia ajuda não estou achando essa tag ou arquivo.lua
4) Adicione a seguinte linha ao seu global.lua:
Código: dofile ('data / lib / crafting.lua')

alguém poderia ajuda nessa parte por favor
 
Top