-
Notifications
You must be signed in to change notification settings - Fork 0
.Scripting
red-the-random-dev edited this page Oct 1, 2021
·
1 revision
DotRPG has a support for Lua scripting. Script runtime is designed the way that .lua files are executed upon loading, which allows to define needed functions.
Built-in LuaModule class runs loop() function of loaded file whenever its Update() method is called. Lua Module also has countdown of times loop function has been called, which can be used for doing actions designed for different events, total number of which is defined by file's event_counter global variable. Note that it is possible to import CLR assemblies within .lua file.
Example with dialog line selection:
import ('DotRPG.Scripting', 'DotRPG.Objects')
event_count = 7
function loop(eventID, frameTime, totalTime)
if eventID == 0 then
dialog.Text = "The door is locked."
elseif eventID == 1 then
dialog.Text = "You should better go elsewhere."
scene.ExitDialog = true
elseif eventID == 2 then
dialog.Text = "The door is definitely locked."
scene.ExitDialog = true
elseif eventID == 3 then
dialog.Text = "Door won't open if you check on it constantly."
scene.ExitDialog = true
elseif eventID == 4 then
dialog.Text = "Don't you have better things to do?"
scene.ExitDialog = true
elseif eventID == 5 then
dialog.Text = "The door is lo"
scene.AutoScroll = true
elseif eventID == 6 then
dialog.Text = "Ah, you are still here?!"
scene.ExitDialog = true
end
endModules:
- .Objects.Complexity (undone)
- .Objects.Dynamics
- .Scripting
- .Scripting.Pipeline (undone)