Billboard messages in an Array?

Anyone know how you would go about making an array of messages for a billboard? It doesn’t seem to play friendly, because it needs the to function correctly. But I need a whole bunch in an array referenced by an int.

Eg this thing:

ExampleBillboardText1<localizes> : message = "My Text 1"

What you can do is create a general message variable, then use an array of strings to specify the contents of the message.

Here is an example:

BillboardStrings: []string = array{ "Text1" , "Text2", "Text3" }

# This creates a message variable that can take in a string as input
# the string will then be localized to the message
BillboardMessage<localizes>( Text : string ) : message = "{Text}"


# Assume you have an array of billboards
@editable
Billboards : []billboard_device = array{}

FIllBillboards () : void =
   # Loop over the array of billboard devices, grabbing the index along
   # the way to access the billboard string elements
    for (Index -> Billboard : Billboards, BillboardString := BillboardStrings[Index]):
        # Note that here, we pass in the Billboard message as an argument to
        # the SetText. Then, we pass in a string as an argument to our
        # message variable, In this case the string that belongs to our 
        # string array at the given Index
        Billboard.SetText(BillboardMessage(BillboardString))

In short, the BillbordMessage is given an argument “Text” of type string. This means we can pass in the BIllboardMessage variable while having the ability to change its text with any string variable. We use this fact to create a list of strings, and simply pass in a string from the array. You could also pass in any string literal

2 Likes

That worked perfectly. Thank you so much!

1 Like