-
Notifications
You must be signed in to change notification settings - Fork 684
Dialogue Coding
init 5 python:
addEvent(
Event(
persistent.event_database,
eventlabel="monika_twitter",
category=['monika'],
prompt="Twitter",
random=True
)
)
label monika_twitter:
m 1eud "Did you know I'm on Twitter?"
# ...
return
Standard dialogue (dialogue that is brought up randomly or is trigger by the player using the "Say/Hey Monika" option) known as a "topic". Topic creation consists of two parts: the init 5 block
and the actual dialogue. The init 5 block
assigns properties to the topic, which can change how the topic can be seen and where it can be found.
While "Topic" is used to refer to standard dialogue, the structure behind a topic is an Event
. The init 5
block is used to assign properties to these Event
s as well as tell the system that an Event
exists.
The Event
object can accept several properties, the most commonly used are shown here:
init 5 python:
addEvent(
Event(
persistent.event_database,
eventlabel="monika_topic_name",
category=["category name", "another category name"],
prompt="Prompt Name",
random=True,
pool=True,
aff_range=(mas_aff.NORMAL, None)
)
)
-
eventlabel
- the label of your topic. This should correspond to the label used for the actual dialogue. Standard topics should use a label prefix ofmonika_
. This is required. -
category
- category names this topic should belong to. This is used when viewing the topic in "Repeat Conversation" or "Say/Hey Monika" -
prompt
- text shown on the button that will trigger this topic. This is used when viewing the topic anywhere in the "Talk Menu" -
random
- True will allow this topic to be shown randomly. This should be used for topics where Monika initiates the conversation. -
pool
- True will allow this topic to appear in the Unseen menu as well as the "Say/Hey Monika" menu. This should be used for topics where the player initiates the conversation. -
aff_range
- this limits the availability of the topic based on Monika's current affection. UsingNone
will specify unlimited range, so using(mas_aff.NORMAL, None)
means that the topic is available from NORMAL affection and above. Available affection levels:-
BROKEN
- Monika appears broken -
DISTRESSED
- Monika looks sad -
UPSET
- Monika shows a neutral, uninterested expression. This does not mean the literal meaning of upset -
NORMAL
- standard affection. Monika has the standard smile (1eua) -
HAPPY
- Monika shows happier expressions -
AFFECTIONATE
- Monika is affectionate -
ENAMORED
- Monika is enamored with the player -
LOVE
- Monika is completely comfortable with the player
-
See definitions.rpy
for the full list of properties. Many of these properties are specific to certain types of events and are not for standard dialogue usage.
Dialogue is standard renpy dialogue code. The general format is:
m spritecode "Dialogue"
For spritecodes, use the Sprite Previewer
MAS uses its own form of menus, the structure to follow is as such:
m expression "Question?{nw}"
$ _history_list.pop()
menu:
m "Question?{fast}"
"Option 1":
#Dialogue/code for this path
"Option 2":
#Dialogue/code for this path
#...:
#...
- The
{nw}
tag on the first Question line. This ensures the player sees the question before the options come up, and that they come up automatically. - The
$ _history_list.pop()
after the first question line. This makes sure that the question only appears once in the history tab. - The lack of
expression
on the second question line. Menus do not accept expressions inside them. - The
{fast}
tag on the second question line. This ensures that the line is shown instantly after the menu options come up.
if
is used when you want to make code execute or dialogue show if the provided condition is True
.
elif
is used after an if
. It also has a condition on it and is evaluated if the condition above it is False
.
else
is the fallback case. If none of the if
or elif
conditions evaluate to True
, else
is run. (Though it is not required to be chained with if
or elif
)
x = 3
if x == 1:
print("x is 1!")
elif x == 3:
print("x is 3!")
#There can be more conditions between here
else:
print("x isn't 1 or 3!")
In this example, the elif
block runs, and "x is 3!"
would be printed.
NOTE: that equality comparisons are done by using ==
instead of =
If you're checking variable string
s, use the following form:
if stringvar.lower() == "comparison":
pass
- This is done because
"Hello"
is not the same as"hello"
You can access the amount of times a topic has been seen using mas_getEV("eventlabel").shown_count
. (NOTE: that eventlabel
must be valid or you will get an error)
To have dialogue change on different repeats of topics, you can check the shown count during a topic, as it is only updated after it has been seen.
label monika_example:
ev = mas_getEV("monika_example")
if ev.shown_count == 0:
m 1hub "This is the first time you've seen this topic!"
elif ev.shown_count == 1:
m 3eub "This is the second time you've seen this topic."
#You can keep going here
else:
m 1wud "Wow [player], you've seen this topic so many times!"
return
The conditional
property of an Event
allows you to make your topic's action
property to happen if the conditional evaluates to True
.
If you would like your topic to be triggered at a certain time while the player is with Monika, Event
s have two properties for this, a start_date
and an end_date
property.
These are can be datetime.datetime
or datetime.date
objects and will work in tandem with the conditional if it is present (It is possible to use start/end dates exclusively or conditionals exclusively)
These properties also will make the action
property happen.
-
EV_ACT_QUEUE
- queues an event -
EV_ACT_PUSH
- pushes an event (higher priority than queue) -
EV_ACT_RANDOM
- sets the event'srandom
property toTrue
(can be brought up in random chatter) -
EV_ACT_POOL
- sets the event'spool
property toTrue
(can be accessed through theHey [m_name]...
option in theTalk
screen) -
EV_ACT_UNLOCK
- unlocks the event (NOTE: This only allows the event to be seen in therepeat conversation
orHey [m_name]...
sections in theTalk
screen)
- The conditional must be written as a
string
- The condition must also be able to be evaluated at
init 5
(You cannot use methods defined at higher init levels) - Using a start or end date will make the event's
prompt
(eventlabel
if not present) show up on the calendar by default. (This can be avoided by using theskipCalendar
parameter) -
end_date
s are not inclusive.start_date
s are
init 5 python:
addEvent(
Event(
persistent.event_database,
eventlabel="monika_example",
prompt="The Southern hemisphere"
category=["misc"],
conditional="persistent._mas_pm_lives_south_hemisphere",
start_date=datetime.date(2019, 4, 15),
end_date=datetime.date(2019, 4, 16)
action=EV_ACT_PUSH
)
)
label monika_example:
#dialogue
return
This example topic will be pushed if you tell Monika that you live in the Southern hemisphere and it is between April 15th and 16th in 2019.