Hey! I’m creating a custom dialog device, in which you can choose between 2 responses and depending on which one you choose the next dialog will show. I made this using a class called dialog and adding it to an array in the device class, as you can see in the code below.
My problem is that I can’t figure out how to access the “Binding1” and “Binding 2” from the main device class. Also if someone has any suggestions on how to make this device better or if I made any mistake please tell me, I’m a verse beginner and I usually don’t know what I’m doing
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
dialog := class<concrete>():
@editable OnShownEvent : []trigger_device = array{}
@editable var Body : string = "..."
@editable var Response1 : string = "..."
@editable var Binding1 : int = -1
@editable var Response2 : string = "..."
@editable var Binding2 : int = -1
@editable PPDialogDevice : popup_dialog_device = popup_dialog_device{}
ShowDialog():void=
PPDialogDevice.SetDescriptionText(StringToMessage("{Body}"))
PPDialogDevice.SetButtonText(StringToMessage("{Response1}"), 0)
PPDialogDevice.SetButtonText(StringToMessage("{Response2}"), 1)
PPDialogDevice.Show()
HideDialog():void=
PPDialogDevice.Hide()
Shown():void=
Print("Message Shown")
for(Trigger:OnShownEvent):
Trigger.Trigger()
StringToMessage<localizes>(value: string)<computes>: message = "{value}"
dialog_device := class(creative_device):
@editable ShowEventTrigger : trigger_device = trigger_device{}
@editable Response1 : trigger_device = trigger_device{}
@editable Response2 : trigger_device = trigger_device{}
@editable DialogTree : []dialog = array{}
OnBegin<override>()<suspends>:void=
ShowEventTrigger.TriggeredEvent.Subscribe(ShowFirst)
Response1.TriggeredEvent.Subscribe(ShowDir1)
Response2.TriggeredEvent.Subscribe(ShowDir2)
ShowFirst(Agent:?agent):void=
set CurrentDialog = 0
if(Popup := Dialog[0]):
Popup.ShowDialog()
ShowDialog := dialog{}
ShowDialog.Shown()
ShowDir1(Agent:?agent):void=
#Here goes the code to enable the next dialog if response was 1, the info to choose wich dialog from the array to choose is in the variable 'Binding1' in the dialog class.
ShowDir2(Agent:?agent):void=
#Here goes the code to enable the next dialog if response was 2, the info to choose wich dialog from the array to choose is in the variable 'Binding2' in the dialog class.