Narrat Docs
Search…
Example narrat script
Used in the demo​
Look at the example code to see syntax.
​
1
main:
2
"You open the narrat demo and wonder how this thing even works"
3
choice:
4
"How about asking for help?"
5
"Ask for help":
6
jump askForHelp
7
"No, I don't want help 😑"
8
jump dontAskForHelp
9
​
10
askForHelp:
11
play sound "alarm"
12
wait 2000
13
play sound "alarm"
14
wait 2000
15
play sound "alarm"
16
clear_dialog
17
talk helper idle "Hello! I heard you're trying to play the narrat demo!"
18
talk helper idle "As you've probably noticed, you can make choices in this."
19
talk helper idle "There are lots of things you can do to make an interactive story in Narrat really. Choices are one of the most useful ones."
20
talk helper idle "I'm going to send you to my other friend who has some questions for you."
21
jump askAboutChoices
22
​
23
askAboutChoices:
24
choice:
25
talk cat idle "Hi it's me, another generic cat! Do you like making choices in games?"
26
"Yes":
27
set likeChoices true
28
"Cat will remember this."
29
"No":
30
set likeChoices false
31
"Cat will remember this."
32
choice:
33
talk helper idle "Now I think we should do an activity, what do you like doing?"
34
"let's make choices cause I like making choices!" $if this.data.likeChoices: // A choice can have a condition so it only appears in the list if the condition is met
35
jump makeChoices
36
"let's do nothing!":
37
jump doNothing
38
​
39
​
40
dontAskForHelp:
41
clear_dialog
42
talk inner idle "Maybe we should get help though? I don't really know what else to do"
43
jump main
44
​
45
makeChoices:
46
choice:
47
talk inner idle "I don't know, we've been making a lot of choices already lately."
48
"I still want to make a choice!":
49
talk helper idle "Well you just made one, it turns out. Can we continue now?"
50
jump doNothing
51
"I guess you're right":
52
jump doNothing
53
​
54
​
55
doNothing:
56
choice:
57
talk music_cat idle "How about we get some music in here?"
58
"Yeah! Play some epic music":
59
play music metal
60
"Play some relaxing music":
61
play music calm
62
"I hate music":
63
talk music_cat idle "Well too bad, it's up to you."
64
jump otherFeatures
65
​
66
otherFeatures:
67
talk helper idle "There are lots of other features, like skill checks and conditions."
68
$if this.skillCheck("someSkillCheck", "testSkill", 40): // You can use skillchecks in conditions
69
"For example this line only appears if you passed a skill check"
70
"This engine is still very early and not fully documented yet, but you can use at the example demo and how it is made."
71
"There is also a screen feature on the left where you can display background images with interactive buttons."
72
jump showMap
73
​
74
showMap:
75
set_screen map
76
set_button parkButton true
77
talk helper idle "This is an example map. There are buttons you can click on. It is possible to dynanically enable and disable buttons in your script"
78
​
79
shopButton:
80
"You visit the shop and buy some water and a snack"
81
talk inner idle "That water was very hydrating!"
82
talk helper idle "Now that you're well hydrated and on your way to eat your 5 a day, you could learn more about how to make games"
83
talk helper idle "The best way is to read the readme page on the narrat github page"
84
talk helper idle "You can look at how the demo is made, especially by opening the example.rpy file which is the script for this demo"
85
​
86
parkButton:
87
"You go on a walk to the little park"
88
talk inner idle "That was a nice walk! Now I feel like going to the shop to buy water"
89
set_button shopButton true
Copied!
Copy link