Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- * notes * --
- -- some quick examples of startAction() | stopAction()
- -- start action has a return value so we'll do a version for that too!
- -- execute startAction in an object action like so: start_action(typ, "csname", "objname", "actname")
- -- execute stopAction in an object action like so: stop_action(typ, "csname", "objname", "actname")
- -- * function variables * --
- -- typ = int{1,2 or 3} - (1[sceneAction], 2[scene > objectAction], 3[characterAction])
- -- csname = "string" (nil or character|scene name)
- -- objname = "string" (nil or scene object name)
- -- actname = "string" (action name)
- -- * example * --
- -- start_action(3, "Robert", "nil", "play_sound") -- starts "play_sound" action via character Robert's action tab!
- function start_action(typ, csname, objname, actname)
- if typ == 1 then
- local act = getObject('Scenes[' .. csname .. '].SceneActions[' .. actname .. ']')
- if startAction(act) then print('SceneAction: ' .. csname .. ', ' .. actname .. ' has been started!') end
- else
- if typ == 2 then
- local act = getObject('Scenes[' .. csname .. '].SceneObjects[' .. objname .. '].ObjectActions[' .. actname .. ']')
- if startAction(act) then print('ObjectAction: ' .. csname .. ', ' .. objname .. ', ' .. actname .. ' has been started!') end
- else
- if typ == 3 then
- local act = getObject('Characters[' .. csname .. '].CharacterActions[' .. actname .. ']')
- if startAction(act) then print('CharacterAction: ' .. csname .. ', ' .. actname .. ' has been started!') end
- end -- typ = 3
- end -- typ = 2
- end -- typ = 1
- end -- function
- function stop_action(typ, csname, objname, actname)
- if typ == 1 then
- local act = getObject('Scenes[' .. csname .. '].SceneActions[' .. actname .. ']')
- stopAction(act)
- print('SceneAction: ' .. csname .. ', ' .. actname .. ' has been stopped!')
- else
- if typ == 2 then
- local act = getObject('Scenes[' .. csname .. '].SceneObjects[' .. objname .. '].ObjectActions[' .. actname .. ']')
- stopAction(act)
- print('ObjectAction: ' .. csname .. ', ' .. objname .. ', ' .. actname .. ' has been stopped!')
- else
- if typ == 3 then
- local act = getObject('Characters[' .. csname .. '].CharacterActions[' .. actname .. ']')
- stopAction(act)
- print('CharacterAction: ' .. csname .. ', ' .. actname .. ' has been stopped!')
- end -- typ = 3
- end -- typ = 2
- end -- typ = 1
- end -- function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement