Graphics

 View Only
  • 1.  Script to select county colors in a map

    Posted 06-24-2025 15:25

    Good afternoon,

    I'm working on a scene that allows users to select a county from a list then select a color from another list.  My idea was to build an array for the counties then build a condition statement that matches the selected county and sets the color.  It works when you set one county, but when you select another county it resets the first and colors the second.  Therefore, counties will not hold the chosen color when selecting another county.  Portion of the script I'm working on is below, and the scene is attached.  Thank you for your help!

    dim txtSelectCounty, txtCountyColor as xpTextObject

    dim objCounty as xpQuadObject

    dim arrCounty(4), arrColor(4) as string

    dim x as integer
    arrCounty(0) = "Appling"
    arrCounty(1) = "Atkinson"
    arrCounty(2) = "Bacon"
    arrCounty(3) = "Baker"
    x = 0
    engine.DebugMessage("Selected County = " & txtSelectCounty.Text, 0)
    'set counties
    Do Until x > 3
    engine.DebugMessage("County = " & arrCounty(x), 0)
    arrColor(x) = "Gray"
    If arrCounty(x) = txtSelectCounty.Text Then
       arrColor(x) = txtCountyColor.Text
    End If
    engine.DebugMessage("County = " & arrCounty(x) & " Color = " & arrColor(x), 0)
    Self.GetObjectByName(arrCounty(x), objCounty)
    Self.Project.GetMaterialByName("GA_" & arrCounty(x) & "_" & arrColor(x) & "_Image", matCounty)
    objCounty.SetMaterial(0, matCounty)
    x = x + 1
    Loop


    ------------------------------
    John Robbins
    Graham Media Group INC
    ------------------------------


  • 2.  RE: Script to select county colors in a map

    Posted 06-25-2025 00:03

    Hey John!

    I don't see the scene attached. Where are you running this script?



    ------------------------------
    Zachary Fradette
    United States
    ------------------------------



  • 3.  RE: Script to select county colors in a map

    Posted 06-25-2025 09:15
      |   view attached

    Thank you for responding.  Not sure why the scene didn't attach, so hopefully it did this time :-) 

    I'm running the script in OnPrepare.  Thanks for the assist!



    ------------------------------
    John Robbins
    Graham Media Group INC
    ------------------------------

    Attachment(s)

    zip
    GMG GA Map.zip   2.00 MB 1 version


  • 4.  RE: Script to select county colors in a map

    Posted 06-26-2025 12:25

    Hmmm.... I'm not sure if we'll be able to tackle what you want to do this direction. Each time we go to Prepare, it's running everything all-new, so there's no memory of what we've done previously... I even tried down the road I saw you attempting with OnSetText, but same situation, the first time the text is being set is when we preview, and it'll only have the knowledge of what it's currently set at right now.

    Theoretically, if this were on a manually operated studio, we could have our scripts update the actual published object field of the take item that's created, but I don't know if that'll work in a MOS environment, since I don't think a take item is actually created by the BlueBox OFL/Gateway while the graphic is being generated.



    ------------------------------
    Zachary Fradette
    United States
    ------------------------------