Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Python by illuminae ( 6 years ago )
extends Control
var data
var title
var caption
var icon
var page
var target
var scroll_timer
#inside the $dialogue_data script
#dialogue_name = [
# [title(name), followup_eventname],
# [
# [icon(face expression image), caption(dialogue), scrollspeed],
# [icon(face expression image), caption(dialogue), scrollspeed],
# [icon(face expression image), caption(dialogue), scrollspeed]]
# ]
func _ready():
data = $dialogue_data
title = $title
caption = $caption
icon = $icon
page = 0
target = []
scroll_timer = $scroll_timer
play("test")
func play(dialogue):#call this to start dialogue
target = data.get(dialogue)
page = 0
title.set_bbcode(target[0][0])
set_page()
scroll_timer.start()
GLOBAL.freeze(true)#function in GLOBAL to stop all entities from moving
visible = true
func set_page():
scroll_timer.wait_time = target[1][page][2]
icon.set_texture(target[1][page][0])
caption.set_visible_characters(0)
caption.set_bbcode(target[1][page][1])
func off():
visible = false
scroll_timer.stop()
GLOBAL.freeze(false)
func followup():#followup handler
match target[0][1]:
"followup_eventname":
pass
func _process(delta):
if Input.is_action_just_pressed("ui_accept"):
if caption.get_visible_characters() >= caption.get_total_character_count():
if page <= target[1].size()-1:
page += 1
if page != target[1].size():
set_page()
else:
if target[0][1] != "none":
followup()
else:
off()
else:
caption.set_visible_characters(caption.get_total_character_count())
func _on_scroll_timer_timeout():
if caption.get_visible_characters() < caption.get_total_character_count():
SOUND.play("text", 2)#autoloaded scene that plays sound
caption.set_visible_characters(caption.get_visible_characters()+1)
Revise this Paste
Children: 109130