This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
if (_qp == nil) then
_qp = {}
math.randomseed( os.time() )
end
_qp.cmd = {}
_qp.cmd.objThis = emptyObject
_qp.cmd.objLast = emptyObject
_qp.cmd.cmdLast = emptyObject
_qp.cmd.altAction = nil
_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]')
registerEventHandler('mainLoop', '_qpmain')
_qp.getObjLangName = function(obj)
if obj:isEmpty() then
return "--: empty :--"
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
_qp.cmd.setActionText = function(text)
print(text)
end
_qp.cmd.callItemCommand = function(_cmd, _item)
-- NYI
return false
end
function _qpmain()
_qp.cmd.objThis = game:getLink(VGameCurrentObject)
-- skip if nothing happend
if _qp.cmd.objThis == _qp.cmd.lastObj
then return end
_qp.cmd.altAction = nil
_qp.cmd.onChangeObjectcommand()
_qp.cmd.lastObj = _qp.cmd.objThis
end
_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
local cmd = game:getLink(VGameActiveCommand)
local cmdName = cmd:getName()
for _,v in ipairs(_qp.cmd.objThis:getLinks(VObjectValues)) do
local valName = v:getName()
local valStr = v:getStr(VValueString)
-- check if cmd is overridden by object
if valName == cmdName then
if _qp.cmd[valStr] ~= nil then
game:setValue(VGameActiveCommand, _qp.cmd[valStr])
end
return true
end
-- check for cmdWalk with walkto
if cmdName == "cmdWalk" and valName == "walkto" then
-- change action text
_qp.cmd.altAction = _qp.getObjLangName(cmd)..
" ".._qp.getObjLangName(Scenes[valStr])
return true
end
-- check if object represents an item
if valName == "item" then
-- call items command action
return _qp.cmd.callItemCommand(cmd, Items[valStr])
end
end
return false
endThis 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.