The luna.lua file includes an example for how to structure your script but I'll also explain it here.
This is very much based on tables, there are two tables that you need, your message set and your script. Your message set contains all the information for a set of messages while your script is the collection of all your message sets, you can even trigger functions inside of your script.
The way your message sets should be organized should be like this:
Code: Select all
-- The name of the message set can be anything.
messageSet = {
-- All the variables you see here NEED to be in the message set.
Name = "Mario",
ImageFolder = "Mario", -- The name of the folder the graphics are in, must be in the level's Graphics folder.
x = 70, -- The position of the main character image.
y = 10, -- The position of the main character image.
Messages = { -- All the lines of the message set, "Emotion" is any image found in the character folder, "Message" is what the character will actually say.
{Emotion = "happy", Message = "Howdy! It's a me, a Mario!"},
{Emotion = "ready", Message = "Or should I say.... Chris Pratt???"},
{Emotion = "ready", Message = "Or should I say.... Garfield???"},
{Emotion = "happy", Message = "Anyway, welcome to visualNovel.lua!"},
}
}
The way your scripts should be organized is like this:
Code: Select all
-- The collection of message sets in one big script, can be named anything
Script = {
-- Place each message set into here.
messageOne,
messageTwo,
messageThree,
messageFour,
{function() SFX.play(19) end}, -- You can have functions in your script, it HAS to be surrounded by curly brackets.
"end" -- Each script has to end with end.
}
One last thing, you can trigger your script at any time you want and the game will pause while it's running, so nothing distracts from the script.
In order to trigger the script you need to run this anywhere within your code.