-
Notifications
You must be signed in to change notification settings - Fork 12
/
console.rpy
99 lines (83 loc) · 2.89 KB
/
console.rpy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Console.rpy
# This defines the Monika Console that appears in the game when
# Monika deletes characters
# Use this as a starting point if you want to override this with your own.
# The gray transparent overlay box on screen
image console_bg:
"#333"
topleft
alpha 0.75 size (480,180)
# Font for the console
style console_text:
font "gui/font/F25_Bank_Printer.ttf"
color "#fff"
size 18
outlines []
# Text Speed of the console
style console_text_console is console_text:
slow_cps 30
# Additional Styling for the console
default consolehistory = []
image console_text = ParameterizedText(style="console_text_console", anchor=(0,0), xpos=30, ypos=10)
image console_history = ParameterizedText(style="console_text", anchor=(0,0), xpos=30, ypos=50)
image console_caret = Text(">", style="console_text", anchor=(0,0), xpos=5, ypos=10)
# This defines the function that displays text in the console
label updateconsole(text="", history=""):
show console_bg zorder 100
show console_caret zorder 100
show console_text "_" as ctext zorder 100
show console_text "[text]" as ctext zorder 100
$ pause(len(text) / 30.0 + 0.5)
hide ctext
show console_text "_" as ctext zorder 100
call updateconsolehistory (history)
$ pause(0.5)
return
# This clears all console history from the console
label updateconsole_clearall(text="", history=""):
$ pause(len(text) / 30.0 + 0.5)
$ pause(0.5)
return
# Beta console from Dan
label updateconsole_old(text="", history=""):
$ starttime = datetime.datetime.now()
$ textlength = len(text)
$ textcount = 0
show console_bg zorder 100
show console_caret zorder 100
show console_text "_" as ctext zorder 100
label updateconsole_loop:
$ currenttext = text[:textcount]
call drawconsole (drawtext=currenttext)
$ pause_duration = 0.08 - (datetime.datetime.now() - starttime).microseconds / 1000.0 / 1000.0
$ starttime = datetime.datetime.now()
if pause_duration > 0:
$ pause(pause_duration / 2)
$ textcount += 1
if textcount <= textlength:
jump updateconsole_loop
$ pause(0.5)
hide ctext
show console_text "_" as ctext zorder 100
call updateconsolehistory (history)
$ pause(0.5)
return
label drawconsole(drawtext=""):
show console_text "[drawtext]_" as ctext zorder 100
return
# This adds passed text to the console history
label updateconsolehistory(text=""):
if text:
python:
consolehistory.insert(0, text)
if len(consolehistory) > 5:
del consolehistory[5:]
consolehistorydisplay = '\n'.join(map(str, consolehistory))
show console_history "[consolehistorydisplay]" as chistory zorder 100
return
# Hides the whole console
label hideconsole:
hide console_bg
hide console_caret
hide ctext
hide chistory