So I’m updating an old outdated Verse UI snippet I wrote months ago, which was broken by API changes. It appears my main issue is that in Verse the use of string for text blocks and buttons has been replaced with message. Could y’all help me fix a few lines? I thought it would be a quick fix of me just dropping in " : message = " where needed, but I guess not! Any help is welcome
I have two main problem areas:
1. Defining variables for text_block widgets with blank Default Text that I set later in the script:
var WidgetLine1:text_block = text_block { DefaultText := ""}
Error:
Red underline underneath the “” part, with the error “This variable expects to be initialized with a value of type message, but this initializer is an incompatible value of type []char.(3509)”
I understand this means that I need to define default text as a message type, right?
So I tried:
var WidgetLine2:text_block = text_block { DefaultText : message = "" }
or
var WidgetLine2:text_block = text_block { DefaultText<localizes> : message = "" }
Error:
The word “message” is underlined in red, with the error “Unexpected expression”. What does that mean? Am I not allowed to use message inside of variables?
2. Converting strings from exposed properties into messages:
These are examples of my exposed properties for my UI text, and functions that that don’t work anymore.
@editable TextTitle: string = ""
@editable TextLine1List: []string = array{}
WidgetTitle.SetText("{TextTitle}")
if(currentStr := TextLine1List[Index]){
WidgetLine1.SetText(currentStr)
Error:
“This function parameter expects a value of type message, but this argument is an incompatible value of type []char.(3509)”
Because the TextTitle property is a string type, not a message, I can’t it for SetText(). But I can’t expose message types as properties, because I get the error “The editable attribute is not supported for classes that aren’t concrete.” So how do I convert the string, and the array of strings, into messages?
Thanks in advance! I look forward to publishing my fixed snippet for everyone!