This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Until 1 Dec 2026 all licenses are 30 % off, for example the Indie Bundle for €69.30 instead of €99. The code BLACKFRIDAY is applied automatically at checkout.
See licenses Try it for freeif (_qp == nil) then
_qp = {}
end
_qp.cmd = {}
_qp.cmd.objThis = emptyObject
_qp.cmd.objLast = emptyObject
_qp.cmd.cmdLast = emptyObject
_qp.cmd.curCmd = _qp.cmd['cmdWalk']
_qp.cmd.altObj = emptyObject
_qp.cmd.altName = ""
_qp.cmd['cmdWalk'] = getObject('Interfaces[_default].InterfaceButtons[cmdWalk]')
_qp.cmd['cmdLook'] = getObject('Interfaces[_default].InterfaceButtons[cmdLook]')
_qp.cmd['cmdUse'] = getObject('Interfaces[_default].InterfaceButtons[cmdUse]')
_qp.cmd['cmdTalk'] = getObject('Interfaces[_default].InterfaceButtons[cmdTalk]')
_qp.cmd['cmdGive'] = getObject('Interfaces[_default].InterfaceButtons[cmdGive]')
_qp.cmd['cmdTake'] = getObject('Interfaces[_default].InterfaceButtons[cmdTake]')
_qp.cmd['cmdPush'] = getObject('Interfaces[_default].InterfaceButtons[cmdPush]')
_qp.cmd['cmdPull'] = getObject('Interfaces[_default].InterfaceButtons[cmdPull]')
_qp.cmd['cmdOpen'] = getObject('Interfaces[_default].InterfaceButtons[cmdOpen]')
_qp.cmd['cmdClose'] = getObject('Interfaces[_default].InterfaceButtons[cmdClose]')
-- mainloop hooking function
function _qphookMain()
_qp.cmd.objThis = game:getLink(VGameCurrentObject)
-- skip if nothing happend
if _qp.cmd.objThis == _qp.cmd.objLast
then return end
_qp.cmd.setAltText(emptyObject, "")
_qp.cmd.onChangeObjectcommand()
_qp.cmd.objLast = _qp.cmd.objThis
end
-- get displayed object name in current language
_qp.getObjLangName = function(obj)
if obj:isEmpty() then return "" end
local id = obj:getId().tableId
if id == eObjects then
return obj:getTextStr(VObjectName)
elseif id == eCharacters then
return obj:getTextStr(VCharacterName)
elseif id == eScenes then
return obj:getTextStr(VSceneName)
elseif id == eButtons then
return obj:getTextStr(VButtonName)
end
end
-- set displayed object name in current language
_qp.setObjLangName = function(_obj, _name)
if _obj:isEmpty() then return end
-- get all texts belonging to the object
local texts = _obj.ObjectName.TextTextLanguages
local ldef = game.StandardLanguage:getId().id
for _,v in ipairs(texts) do
if v.language == ldef then
v.text = _name
-- reassign to trigger update
_obj.ObjectName.TextTextLanguages = texts
break
end
end
end
-- set alternative temporary text
_qp.cmd.setAltText = function(_obj, _altText)
if _qp.cmd.altObj ~= emptyObject then
_qp.setObjLangName(_qp.cmd.altObj,_qp.cmd.altName)
end
_qp.cmd.altObj = _obj
if _qp.cmd.altObj ~= emptyObject then
_qp.cmd.altName = _qp.getObjLangName(_qp.cmd.altObj)
_qp.setObjLangName(_qp.cmd.altObj,_altText)
end
end
-- call an items command
_qp.cmd.callItemCommand = function(_cmd, _item)
local cmds = _item:getLinks(VObjectActions)
for _,v in ipairs(cmds) do
if v.ActionCommand == _cmd then
startAction(v)
end
end
end
-- change current command
_qp.cmd.changeCommand = function(_cmd)
game:setValue(VGameActiveCommand, _cmd)
_qp.cmd.curCmd = _cmd
end
-- called if current target has just changed
_qp.cmd.onChangeObjectcommand = function()
if _qp.cmd.objThis:isEmpty() or
_qp.cmd.objThis:getId().tableId ~= eObjects then
return false
end
-- get command object and internal command name
_qp.cmd.curCmd = game:getLink(VGameActiveCommand)
local nameCmd = _qp.cmd.curCmd:getName()
for _,v in ipairs(_qp.cmd.objThis:getLinks(VObjectValues)) do
local attribute = v:getName()
local valString = v:getStr(VValueString)
-- check if cmd is redirected by object
if attribute == nameCmd then
if _qp.cmd[valString] ~= nil then
_qp.cmd.changeCommand(_qp.cmd[valString])
nameCmd = _qp.cmd.curCmd:getName()
end
end
-- check for cmdWalk with walkto
if attribute == "walkto" and nameCmd == "cmdWalk" then
-- change action text
_qp.cmd.setAltText(_qp.cmd.objThis, _qp.getObjLangName(Scenes[valString]))
return true
end
-- check if object represents an item
if attribute == "item" then
-- call items command action
return _qp.cmd.callItemCommand(_qp.cmd.curCmd, game:getLinks(VGameItems)[valString])
end
end
return false
end
registerEventHandler('mainLoop', '_qphookMain')Exactly, but the other way aroundLets say you have a scene object "apple" with actions for look, take, eat, etc...There is also an Item "apple" which represents the apple. Now you want to call the same actions on the item that you used in the scene object but not want to copy&paste everything redundant?
why not using the "call action" action parts and refer to the items action? No Lua needed...because that would become about three or four call-actions per item instead of one simple to maintain attribute.You still need to create the actions on both so that it gets triggered but in the scene object you just include the "call action" to the items representation if that command.
This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.
New threadDeponia, The Whispered World and more than 160 other games were made with Visionaire Studio. The free version covers up to 25 scenes. For more scenes there is Visionaire Studio PRO from €75, and to sell your game the Indie Bundle for €99.
Through December 1: all licenses 30% off, for example the Indie Bundle for €69.30 instead of €99. Applied automatically at checkout.