So here are the insturcutions to get this working:
For what is it for: For debug purposes. With this function you can give your character all available items in the game without adding them manually with action parts
What is needed: Some kind of debug interface/scene where you have a button to click on.
Instructions:
Add this as a definition script in the scripts section of Visionaire Studio:
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
Add this inside an "Execute a script" action part of your choice:
char = game.CurrentCharacter
inv = {}
for i = 1, #game.Items do
if not string.starts(game.Items[i]:getName(),"-")then
print("added '"..game.Items[i]:getName().."' to the inventory")
table.insert(inv,game.Items[i])
end
end
char:setValue(VCharacterItems, inv)
This action part should be placed when performing a speficic action like klicking on a button inside your debug interface:
Items with an "-" (separator) at the beginning get skipped by the script and won't be added.