So I have 4 materials, one black, one blue, one red, one green. The default one is black.
If a text field = R the red one should be shown
if a text field = D the blue one should be shown
if a text field = G the green one should be shown
If a text field = ANY OTHER LETTER OR SYMBOL, it should be the black one.
I have this working using coding, but I can't get it automatically default back to black if say an M or a Z is placed in the text field. It just stays whatever color was there previously.
Here's the coding.
dim right_cand_bg_black as xpBaseObject
dim right_cand_bg_red as xpBaseObject
dim right_cand_bg_blue as xpBaseObject
dim right_cand_bg_green as xpBaseObject
self.getobjectbyname ("right cand bg_black", right_cand_bg_black)
self.getobjectbyname ("right cand bg_red", right_cand_bg_red)
self.getobjectbyname ("right cand bg_blue", right_cand_bg_blue)
self.getobjectbyname ("right cand bg_green", right_cand_bg_green)
if right_cand_party.text = "D" then
right_cand_bg_black.visible = false
right_cand_bg_red.visible = false
right_cand_bg_blue.visible = true
right_cand_bg_green.visible = false
elseif right_cand_party.text = "R" then
right_cand_bg_black.visible = false
right_cand_bg_red.visible = true
right_cand_bg_blue.visible = false
right_cand_bg_green.visible = false
elseif right_cand_party.text = "G" then
right_cand_bg_black.visible = false
right_cand_bg_red.visible = false
right_cand_bg_blue.visible = false
right_cand_bg_green.visible = true
elseif right_cand_party.text = "I" then
right_cand_bg_black.visible = true
right_cand_bg_red.visible = false
right_cand_bg_blue.visible = false
right_cand_bg_green.visible = false
elseif right_cand_party.text = "L" then
right_cand_bg_black.visible = true
right_cand_bg_red.visible = false
right_cand_bg_blue.visible = false
right_cand_bg_green.visible = false
elseif right_cand_party.text = "" then
right_cand_bg_black.visible = true
right_cand_bg_red.visible = false
right_cand_bg_blue.visible = false
right_cand_bg_green.visible = false
end if
EDIT: Nevermind, figured it out, had to include an ELSE at the end of it all.