- Joined
- Feb 9, 2009
- Messages
- 1,800
Skeleton dating sim is now a possibility...
Dialog Action API (These functions may be used with Dialog_Add as "Action" Parameter)
Change Background
- takes string Background
- Example Usage:
call Dialog_Add("YourDialog", "Change Background Default")
Change BGM
- takes string Music, integer milliseconds [Experimental, might desync]
- Example Usage 1:
call Dialog_Add("YourDialog", "Change BGM Example Music|10")
- Example Usage 2:
call Dialog_Add("YourDialog", "Change BGM Example Music")
Stop BGM
- takes nothing [Experimental, might desync]
- Example Usage:
call Dialog_Add("YourDialog", "Stop BGM")
Add NPC
- takes string NPC, real Speed, string Side
- Example Usage:
call Dialog_Add("YourDialog", "Add NPC Graf Zeppelin|1|Left")
Remove NPC
- takes string NPC, real Speed, string Side
- Example Usage:
call Dialog_Add("YourDialog", "Remove NPC Graf Zeppelin|1|Left")
Change NPC Instant
- takes string NPC, string Side
- Example Usage:
call Dialog_Add("YourDialog", "Change NPC Instant Graf Zeppelin|Left")
Change Speaker
- takes string NPC
- Example Usage:
call Dialog_Add("YourDialog", "Change Speaker Graf Zeppelin")
Change Text
- takes string Text, string Sound
- Example Usage 1:
call Dialog_Add("YourDialog", "Change Text text|Example Voice")
- Example Usage 2:
call Dialog_Add("YourDialog", "Change Text text")
Input Wait
- takes boolean LeftMouseAllowed
- Example Usage 1:
call Dialog_Add("YourDialog", "Input Wait false")
- Example Usage 2:
call Dialog_Add("YourDialog", "Input Wait")
Time Wait
- takes real Seconds
- Example Usage:
call Dialog_Add("YourDialog", "Time Wait 5")
Change Time
- takes real hours, real minutes
- Example Usage 1:
call Dialog_Add("YourDialog", "Change Time 20|40")
- Example Usage 2:
call Dialog_Add("YourDialog", "Change Time 20")
Change InputK
- takes string key
- Example Usage:
call Dialog_Add("YourDialog", "Change InputK y")
Change SkipK
- takes string key
- Example Usage:
call Dialog_Add("YourDialog", "Change SkipK x")
Change SkipS
- takes real speed
- Example Usage:
call Dialog_Add("YourDialog", "Change SkipS 10.0)
Set TextS
- takes real speed
- Example Usage:
call Dialog_Add("YourDialog", "Set TextS 4.0)
Save Variable
- takes string ref, var content, boolean global (global defaults to false)
- Example Usage 1:
call Dialog_Add("YourDialog", "Save Variable speed|4.0|true")
- Example Usage 2:
call Dialog_Add("YourDialog", "Save Variable ikey|y")
- How to load default variable: <.ref>
- How to load player variable: <!ref>
- How to load global variable: <?ref>
Text Input
- takes string ref, boolean global (global defaults to false)
- Example Usage 1:
call Dialog_Add("YourDialog", "Text Input name")
- Example Usage 2:
call Dialog_Add("YourDialog", "Text Input name|true")
- The examples would store the confirmed text input value into variable "name"
Multiple Choice
- takes string Option 1, string Option 2, string Option 3, string Option 4, string Option 5
- Example Usage 1:
call Dialog_Add("YourDialog", "Multiple Choice btn1|btn2|btn3")
- Example Usage 2:
call Dialog_Add("YourDialog", "Multiple Choice btn1|btn2")
Choice State
- takes string id, boolean isEnabled
- Example Usage 1:
call Dialog_Add("YourDialog", "Choice State testbtn1|true")
- Example Usage 2:
call Dialog_Add("YourDialog", "Choice State testbtn2|false")
How Multiple Choice works:
How Multiple Choice works:
How Multiple Choice works:
- Create Choice Buttons with Choice_Add()
- If you want for example only 3 options, just stop after option 3. [Maximum amount is 5]
- Last selected choice will always be stored in: Get_Last_Choice()
- Explanation how "Follow Up" works:
- When Follow Up exists: Dialog will have a transition to the dialog id that is named in dialog follow up.
- When Follow Up DO NOT exists: Dialog will continue normally.
File Pathings:
File Pathings:
File Pathings:
- Important Info for NPC Sprite:
"UI\\Dialog\\NPCs\\" + NPC + ".blp"
- Important Info for Background:
"UI\\Dialog\\Backgrounds\\" + Background + ".blp"
- Important Info for Framework (Dialog Box, Dialog Buttons & Dialog Arrow):
"UI\\Dialog\\Framework\\" + ... + ".blp"
- Important Info for Sounds:
"UI\\Dialog\\Sounds\\" + Sound + ".mp3"
- Important Info for Music:
"UI\\Dialog\\Music\\" + Music + ".mp3"
- Import Info for Font:
"UI\\Font\\" + Font
Additional Info:
Additional Info:
Additional Info:
- You can press right-click to hide/show Dialog Box & Dialog Buttons during dialog.
- Input Wait allows any letter in english alphabet (a - z) ; LeftMouseAllowed defaults to true.
- If mouse is idle for 5 seconds it will hide. (configurable)
- You can color you text like this: <#663399>colored text<#>
// Test Map functions
function Exit_Game takes nothing returns nothing
call RemovePlayer(GetTriggerPlayer(), PLAYER_GAME_RESULT_NEUTRAL)
if GetLocalPlayer() == GetTriggerPlayer() then
call EndGame(true)
endif
endfunction
function Auto_Play_Button takes nothing returns nothing
local integer pID = GetPlayerId(GetTriggerPlayer())
local boolean Auto_Play_Active = not Is_Auto_Play(pID)
local framehandle Auto_Skip_Frame = BlzGetFrameByName("Dialog Menu Button 1-2", 0)
local framehandle Repeat_Frame = BlzGetFrameByName("Dialog Menu Button 1-3", 0)
local string Repeat_Check = LoadStr(Hashtable, GetHandleId(Player(pID)), StringHash("Current Sound File"))
local framehandle Hide_UI_Frame = BlzGetFrameByName("Dialog Menu Button 1-5", 0)
call Set_Auto_Play(GetPlayerId(GetTriggerPlayer()), Auto_Play_Active)
if GetLocalPlayer() == Player(pID) then
call BlzFrameSetEnable(Auto_Skip_Frame, not Auto_Play_Active)
call BlzFrameSetEnable(Hide_UI_Frame, not Auto_Play_Active)
endif
if Auto_Play_Active then
if GetLocalPlayer() == Player(pID) then
call BlzFrameSetEnable(Repeat_Frame, not Auto_Play_Active)
endif
else
if Repeat_Check != null and Repeat_Check != "" then
if GetLocalPlayer() == Player(pID) then
call BlzFrameSetEnable(Repeat_Frame, not Auto_Play_Active)
endif
endif
endif
set Auto_Skip_Frame = null
set Repeat_Frame = null
set Hide_UI_Frame = null
endfunction
function Auto_Skip_Button takes nothing returns nothing
local integer pID = GetPlayerId(GetTriggerPlayer())
local boolean Auto_Skip_Active = not Is_Auto_Skip(pID)
local framehandle Auto_Play_Frame = BlzGetFrameByName("Dialog Menu Button 1-1", 0)
local framehandle Repeat_Frame = BlzGetFrameByName("Dialog Menu Button 1-3", 0)
local string Repeat_Check = LoadStr(Hashtable, GetHandleId(Player(pID)), StringHash("Current Sound File"))
local framehandle Hide_UI_Frame = BlzGetFrameByName("Dialog Menu Button 1-5", 0)
call Set_Auto_Skip(GetPlayerId(GetTriggerPlayer()), Auto_Skip_Active)
if GetLocalPlayer() == Player(pID) then
call BlzFrameSetEnable(Auto_Play_Frame, not Auto_Skip_Active)
call BlzFrameSetEnable(Hide_UI_Frame, not Auto_Skip_Active)
endif
if Auto_Skip_Active then
if GetLocalPlayer() == Player(pID) then
call BlzFrameSetEnable(Repeat_Frame, not Auto_Skip_Active)
endif
else
if Repeat_Check != null and Repeat_Check != "" then
if GetLocalPlayer() == Player(pID) then
call BlzFrameSetEnable(Repeat_Frame, not Auto_Skip_Active)
endif
endif
endif
set Auto_Play_Frame = null
set Repeat_Frame = null
set Hide_UI_Frame = null
endfunction
function Repeat_Current_Button takes nothing returns nothing
call Repeat_Current(GetPlayerId(GetTriggerPlayer()))
endfunction
function Close_UI_Button takes nothing returns nothing
call Change_Dialog_Box_State(GetPlayerId(GetTriggerPlayer()))
endfunction
function Dummy_Dialog takes nothing returns nothing
local integer pID = GetPlayerId(GetTriggerPlayer())
call Initiate_Dialog(pID, "Intro")
endfunction
function Test_Map takes nothing returns nothing
local trigger t
local integer pID = 0
// Choice_Add(id, content, isEnabled, followUp)
call Choice_Add("ChoiceA", "I want to use the input button <#ff7f00>a<#>.", true, "inputA")
call Choice_Add("ChoiceJ", "I want to use the input button <#ff7f00>j<#>.", false, "inputJ")
call Choice_Add("ChoiceY", "I would like to keep it as it is.", true, "inputY")
// Dialog_Add(id, dialog action)
call Dialog_Add("Intro", "Save Variable latertw|3.5|true")
call Dialog_Add("Intro", "Change InputK y")
call Dialog_Add("Intro", "Add NPC Tutorial Girl|1|Left")
call Dialog_Add("Intro", "Change Speaker <#add8e6>Tutorial Girl")
call Dialog_Add("Intro", "Change Text Oh, hello there. Whats your name?")
call Dialog_Add("Intro", "Text Input name")
call Dialog_Add("Intro", "Change Text Nice to meet you <!name>, seems like you are interested in knowing how this system works, right?")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change Text Lets get a swap to a better looking place first.")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change Background Default")
call Dialog_Add("Intro", "Change Text ...")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change Text How I did this you ask?")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change Text You simply do the action <#ff7f00>Change Background Default<#>, it switches the background to <#ff7f00>UI\\Dialog\\Backgrounds\\Default.blp<#>.")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change Text Its a bit quiet here, dont you think so? Lets get some sounds.")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change BGM Default")
call Dialog_Add("Intro", "Change Text To do this I used <#ff7f00>Change BGM Default<#>, it switches the music to <#ff7f00>UI\\Music\\Default.blp<#>.")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change Text You gotta do this and that and that and there you go, you finished your stuff easily and fast.")
call Dialog_Add("Intro", "Change Text Whoops, forgot to put a break there.\nUse <#ff7f00>Input Wait<#> to make the game wait for the current input key\n(Can be changed with <#ff7f00>Change InputK<#>)")
call Dialog_Add("Intro", "Input Wait")
call Dialog_Add("Intro", "Change Text Lets give it a try, choose any of the choice buttons, and i will switch the input button to your choice.")
call Dialog_Add("Intro", "Save Variable entryspd|2.5")
call Dialog_Add("Intro", "Multiple Choice ChoiceA|ChoiceJ|ChoiceY")
call Dialog_Add("inputA", "Save Variable btn|a")
call Dialog_Add("inputA", "Change Speaker <#add8e6>Tutorial Girl")
call Dialog_Add("inputA", "Change Text You want me to change it to <#ff7f00><!btn><#>? Fine, there you go.")
call Dialog_Add("inputA", "Change InputK <!btn>")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Change Text Lets get someone else in this conversation, since you never answer it is getting quite monotone.")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Change Text Add NPC SomeoneMoreInteresting")
call Dialog_Add("inputA", "Add NPC SomeoneMoreInteresting|<!entryspd>|Right")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Change Text Oh, did i say that out loud? Sorry, didnt meant it like that.")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Change Speaker <#FFD700>Tasyen")
call Dialog_Add("inputA", "Change Text huh?")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Change Speaker <#add8e6>Tutorial Girl")
call Dialog_Add("inputA", "Change Text Oh, ups. Wrong Person.")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Remove NPC SomeoneMoreInteresting|<!entryspd>|Right")
call Dialog_Add("inputA", "Change Text You can remove them any time again with <#ff7f00>Remove NPC<#>. In this case I used <#ff7f00>Remove NPC SomeoneMoreInteresting<#>.")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Time Wait <?latertw>")
call Dialog_Add("inputA", "Change Text You thought the system freezed? Dead wrong, I just decided to mimik you.\n(<#ff7f00>Time Wait <?latertw><#> waits <?latertw> real time seconds.)")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Change Text Thats it for the tutorial, you never answer, and i have honestly better stuff to do. Goodbye.")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Change Speaker ")
call Dialog_Add("inputA", "Remove NPC Tutorial Girl|1.5|Left")
call Dialog_Add("inputA", "Choice State ChoiceJ|true")
call Dialog_Add("inputA", "Choice State ChoiceA|false")
call Dialog_Add("inputA", "Change Text Press <!btn> or left-click to end the dialog... (PS: This choice is now disabled, and choice 2 (j) is now enabled)")
call Dialog_Add("inputA", "Input Wait")
call Dialog_Add("inputA", "Stop BGM")
call Dialog_Add("inputJ", "Save Variable btn|j")
call Dialog_Add("inputJ", "Change Speaker <#add8e6>Tutorial Girl")
call Dialog_Add("inputJ", "Change Text You want me to change it to <#ff7f00><!btn><#>? Fine, there you go.")
call Dialog_Add("inputJ", "Change InputK <!btn>")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Change Text Lets get someone else in this conversation, since you never answer it is getting quite monotone.")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Change Text Add NPC SomeoneMoreInteresting")
call Dialog_Add("inputJ", "Add NPC SomeoneMoreInteresting|<!entryspd>|Right")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Change Text Oh, did i say that out loud? Sorry, didnt meant it like that.")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Change Speaker <#FFD700>Tasyen")
call Dialog_Add("inputJ", "Change Text huh?")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Change Speaker <#add8e6>Tutorial Girl")
call Dialog_Add("inputJ", "Change Text Oh, ups. Wrong Person.")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Remove NPC SomeoneMoreInteresting|<!entryspd>|Right")
call Dialog_Add("inputJ", "Change Text You can remove them any time again with <#ff7f00>Remove NPC<#>. In this case I used <#ff7f00>Remove NPC SomeoneMoreInteresting<#>.")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Time Wait <?latertw>")
call Dialog_Add("inputJ", "Change Text You thought the system freezed? Dead wrong, I just decided to mimik you.\n(<#ff7f00>Time Wait <?latertw><#> waits <?latertw> real time seconds.)")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Change Text Thats it for the tutorial, you never answer, and i have honestly better stuff to do. Goodbye.")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Change Speaker ")
call Dialog_Add("inputJ", "Remove NPC Tutorial Girl|1.5|Left")
call Dialog_Add("inputJ", "Change Text Press <!btn> or left-click to end the dialog...")
call Dialog_Add("inputJ", "Input Wait")
call Dialog_Add("inputJ", "Stop BGM")
call Dialog_Add("inputY", "Save Variable btn|y")
call Dialog_Add("inputY", "Save Variable btn2|c")
call Dialog_Add("inputY", "Save Variable spd|5.0")
call Dialog_Add("inputY", "Change Speaker <#add8e6>Tutorial Girl")
call Dialog_Add("inputY", "Change SkipK <!btn2>")
call Dialog_Add("inputY", "Change SkipS <!spd>")
call Dialog_Add("inputY", "Change Text You want me to keep <#ff7f00><!btn><#>? Fine.\n(Skip Button was changed to <#ff7f00><!btn2><#> and Skip Speed was changed to <#ff7f00><!spd><#> for test purpose)")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Change Text Lets get someone else in this conversation, since you never answer it is getting quite monotone.")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Change Text Add NPC SomeoneMoreInteresting")
call Dialog_Add("inputY", "Add NPC SomeoneMoreInteresting|<!entryspd>|Right")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Change Text Oh, did i say that out loud? Sorry, didnt meant it like that.")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Change Speaker <#FFD700>Tasyen")
call Dialog_Add("inputY", "Change Text huh?")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Change Speaker <#add8e6>Tutorial Girl")
call Dialog_Add("inputY", "Change Text Oh, ups. Wrong Person.")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Remove NPC SomeoneMoreInteresting|<!entryspd>|Right")
call Dialog_Add("inputY", "Change Text You can remove them any time again with <#ff7f00>Remove NPC<#>. In this case I used <#ff7f00>Remove NPC SomeoneMoreInteresting<#>.")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Time Wait <?latertw>")
call Dialog_Add("inputY", "Change Text You thought the system freezed? Dead wrong, I just decided to mimik you.\n(<#ff7f00>Time Wait <?latertw><#> waits <?latertw> real time seconds.)")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Change Text Thats it for the tutorial, you never answer, and i have honestly better stuff to do. Goodbye.")
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Change Speaker ")
call Dialog_Add("inputY", "Remove NPC Tutorial Girl|1.5|Left")
call Dialog_Add("inputY", "Change Text Press <!btn> or left-click to end the dialog...")
//call Dialog_Add("inputY", "Change Text <.ptime>, <.gtime>, <.ikey>, <.skey>, <.sspd>, <.gspd>, <.tspd>, <.choice>, <.background>, <.music>, <.aspd>") // can be used if you wanna check the default values.
call Dialog_Add("inputY", "Input Wait")
call Dialog_Add("inputY", "Stop BGM")
// Test Map Trigger for the dummy dialog
loop
exitwhen pID > 23
// Dialog System Related
if GetPlayerController(Player(pID)) == MAP_CONTROL_USER then
set t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(pID), "Dialog", true)
call TriggerAddAction(t, function Dummy_Dialog)
set t = null
endif
// Chat System Related
if GetPlayerName(Player(pID)) == "Zoson" then
call Set_Chat_Color(pID, "c1f9a2")
endif
set pID = pID + 1
endloop
endfunction
// Use Dialog_Remove("test", Slot) to remove a dialog action from dialog "test" (-> moves all others with bigger slot number down by one slot number) [-> Dialog Slot is returned by Dialog_Add]