-
Notifications
You must be signed in to change notification settings - Fork 0
/
writing_engine.gd
38 lines (30 loc) · 981 Bytes
/
writing_engine.gd
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
extends Node
static func pl(rang) -> Array: #prepare lines
var lines = []
for i in range(rang):
lines.append("ln" + str(i))
return lines
func wUrl (url, text) -> String: #write url
return "[color=4f70ff][url=\"" + url + "\"]" + text + "[/url][/color]"
func wDL (text) -> String: #write dead link
return "[color=575757]" + text + "[/color]"
func dUrl(urlToBeDisb) -> String: #disable url
var regex = RegEx.new()
regex.compile("\\].*?\\](.*).*?\\[.*?\\[")
var res = regex.search(urlToBeDisb)
if res:
urlToBeDisb = (wDL(res.get_string(1)))
return urlToBeDisb
func uAct(act) -> String: #user action
var takenAction
match act:
"d": takenAction = "You did: "
"u": takenAction = "You used: "
"p": takenAction = "You picked: "
"b": takenAction = "You bought: "
"k": takenAction = "You killed: "
"s": takenAction = "You said: "
_: return "ACTION ERROR! "
return wDL(takenAction)
func aAct(action, text) -> String:
return uAct(action) + dUrl(text)