PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

5 min

Write the Story

After the player answers all of the questions, they’ll get to see their answers combined with the story. The story will also be stored in a variable using strings and then be combined with the strings holding the player’s answers.

Code the First String

  1. Make sure the playtest is stopped.
  2. Go back to the script by clicking on the StoryManager script tab above the game editor.
Reopening the Script

If you don’t see the script editor tab, you can re-open it by double-clicking on StoryManager in the Explorer window.


  1. Beneath where you typed the question, create a new variable named story. Make sure the variable name is lowercase.
-- Code story between the dashes	
-- =============================================
   
local name1 = storyMaker:GetInput("What is your favorite name?")
   
local story
  1. To find the first string, go back to the original story. Circle or highlight everything before the first placeholder. If your variable happens to be in the middle of a sentence, no problem - the rest can be added later.
Original Placeholder
In a tree on a hill, lives the great wizard name1.
  1. Have the story variable store the string like below:
-- Code story between the dashes	
-- =============================================
   
local name1 = storyMaker:GetInput("What is your favorite name?")
   
local story = "In a tree on a hill lives the great wizard "
Troubleshooting Tips

The code will only show what you tell it to, so include a space at the end so the strings don’t run together.



Previous Second Challenge Next Adding to the Story