#2, by afrlmeSaturday, 17. September 2016, 21:29 7 years ago
Creating pauses between lines of code with Lua script is not very easy at all. It requires creating a loop & then setting an initial time & then checking if x time has passed. I guess you could probably also check if an action is inside of the ActiveActions table, but I do not recommend using the Lua repeat or while loop operators as they tend to cause the Visionaire Studio player to crash.
There's the other problem of Lua reading line by line, so you would need to create an else action part per pause query to include a "return true" or "return false" statement to kill the rest of the actions / lines of code inside of the function.
#4, by SimonSSaturday, 17. September 2016, 23:02 7 years ago
The engine doesn't run any code multithreaded. Every lua script is run synchronously. You can wait all you want the action won't executed. You must leave the lua script. Only way is per mainloop handler and checking activeactions or calling something at the end of the action.
#6, by sebastianSaturday, 17. September 2016, 23:20 7 years ago
so i cant use a ... while(?) loop like
startAction(Actions["some action name"])
while Conditions["action_ended"].ConditionValue == false do
if Conditions["action_ended"].ConditionValue then
...some more code which gets execuded when action_ended is TRUE
and inside of the action i started before i set the condition to true at the end...
@AFRLme: im just doing some theoretical stuff regarding a dialog system which starts a linked action from a lua function and should continue when the called action ended... Of course i can do some script stuff at the end of the action anyway, but i would like to do this in the main started function because it would be more easy to manage later
#7, by afrlmeSaturday, 17. September 2016, 23:28 7 years ago
I really don't recommend using while or repeat x until loop operators. You can try them if you like, but almost every time I've tried using them in a script it ends up crashing the VS player, so I recommend using mainLoop event handlers or called by other action blocks that are looped using the jump to x action parts.
Good call on reminding me of "break" - not needed to use them in anything in an age & a half!
#9, by afrlmeSaturday, 17. September 2016, 23:59 7 years ago
Me or Simon? If you are wanting editor based improvements then Simon would be the one to contact. If you are talking about a custom dialog system made out of Lua & action parts, then sure pm away (except you won't be able to send me a message as my profile seems to one of many that no longer seems to exist on this forum).