Page 1 of 1
Scripting about Alcoved Items ( not solved yet )
Posted: Mon Oct 20, 2014 6:40 pm
by AdrTru
Hi, I have some question for adapt my scripts to new system.
1/ Do you known someone how use alcove scipting?
I mean :containedItems() and :getItemCount() functions.
2/ Is there some function for easy item manipulation?
In LOG1 is need make copy all parameters of item to new one. Is there some function like copyItem or assign?
Or is possible move item between positions directly? e.g. From floor to mouse.
3/ Is there some variable for identifiing status were player look into chest?
For custom gui during player loot some items.
Thank you for help.
Re: Scripting about Alcoved Items
Posted: Mon Oct 20, 2014 6:50 pm
by SnowyOwl47
AdrTru wrote:Hi, I have some question for adapt my scripts to new system.
1/ Do you known someone how use alcove scipting?
I mean :containedItems() and :getItemCount() functions.
2/ Is there some function for easy item manipulation?
In LOG1 is need make copy all parameters of item to new one. Is there some function like copyItem or assign?
Or is possible move item between positions directly? e.g. From floor to mouse.
3/ Is there some variable for identifiing status were player look into chest?
For custom gui during player loot some items.
Thank you for help.
1) Yes I do me,
2) Yes there is,
3) Not Sure, and custom Gui will be hard to do.
Re: Scripting about Alcoved Items
Posted: Mon Oct 20, 2014 7:27 pm
by AdrTru
SnowyOwl47 wrote:
1) Yes I do me,
2) Yes there is,
3) Not Sure, and custom Gui will be hard to do.
Can you write me how I use this functionality?
Re: Scripting about Alcoved Items
Posted: Mon Oct 20, 2014 7:55 pm
by SnowyOwl47
AdrTru wrote:SnowyOwl47 wrote:
1) Yes I do me,
2) Yes there is,
3) Not Sure, and custom Gui will be hard to do.
Can you write me how I use this functionality?
Code: Select all
-- This Adds an item to an alcove: alcove_name.surface:addItem(item)
--
-- This will get the items in an alcove: alcove_name.surface:getItems()
--
-- As far as I know you'll have you make some of your own code for counting the number of items.
Re: Scripting about Alcoved Items
Posted: Mon Oct 20, 2014 9:05 pm
by AdrTru
I try make connector for onRemoveItem from altar_1.
1/ correct working - write altar.name and removed item.name
2/ correct working - spawn ax to this altar
incorect -> when is this function called as onInsertItem - script make loop to stack overflow - becouse function onInsertItem is called every time when is some item created in altar.
3/ :getItems() dont worked ( isnt exist this function in surface )
Code: Select all
function test(alc)
-- 1/
print(alc.go.name.." - "..getMouseItem().go.name)
-- 2/
alc.go.surface:addItem(spawn("ax").item)
-- 3/
-- for item in altar_1.surface:getItems() do -- = alc.go.surface:getItems()
--
-- end
end
Re: Scripting about Alcoved Items
Posted: Mon Oct 20, 2014 9:20 pm
by SnowyOwl47
AdrTru wrote:I try make connector for onRemoveItem from altar_1.
1/ correct working - write altar.name and removed item.name
2/ correct working - spawn ax to this altar
incorect -> when is this function called as onInsertItem - script make loop to stack overflow - becouse function onInsertItem is called every time when is some item created in altar.
3/ :getItems() dont worked ( isnt exist this function in surface )
If I'm getting this right...
Here is what you need to do...
Code: Select all
function test(entity)
print(entity.surface:addItem("axe")
entity.surface:addItem("axe")
end
-- Now you can use this as a method simply call the script_entity something like game, and do the following:
--
-- game.script:test("entity/alcove")
I'm not sure what your trying to do here but thats it.
Re: Scripting about Alcoved Items ( not solved yet )
Posted: Tue Oct 21, 2014 8:15 am
by AdrTru
When your connector calls function in script, this function have sefl parameter
e.g. onInsertItem from alcove to test script: in script is test(self). Where self is Alcove entity.