Hi Shru. In a table i define a function called scriptFunc which has the commands that trigger msg, option, menu etc.
Then i call this function script where
function Player.setScript(scriptFunc)
Player.script = Erogodic(scriptFunc)
:defineAttributes({
'name',
})
:addMacro('giveItem',function(item)
local lastName = get('name')
name ""
msg("You got the " .. item .. "!")
name(lastName)
end)
:addMacro('zone',function(zoneName)
Player.setZone(zoneName)
end)
:addMacro("var",function(varName,value)
if value then
Player.setVariable(varName,value)
else
return Player.getVariable(varName)
end
end)
:addMacro("next",function(value)
if value==nil then
value=Player.getVariable("state")+1
end
Player.setVariable("state",value)
end)
:addMacro("bg",function(fileName)
World.setBackground(fileName)
end)
end
The question is. Is there a way to just set a script function without creating the whole script table and repeating the addMacro or addAttribute?
So far i found only a _pushScript function that works. But the first time i use the erogodic lib it repeats the whole dialog twice and then it continues to work properly. So i still looking for the problem solution on my side.
Hi Shru. In a table i define a function called scriptFunc which has the commands that trigger msg, option, menu etc.
Then i call this function script where
The question is. Is there a way to just set a script function without creating the whole script table and repeating the addMacro or addAttribute?
So far i found only a _pushScript function that works. But the first time i use the erogodic lib it repeats the whole dialog twice and then it continues to work properly. So i still looking for the problem solution on my side.