Hi, I have the following script
dim indiceGeneral, indiceSelectivo, indiceNY, indiceSP, indiceST, indiceBT as xptextObject
dim iconoGeneral, iconoSelectivo, iconoNY, iconoSP, iconoST, iconoBT as xpQuadObject
dim matGeneral, matSelectivo, matNY, matSP, matST, matBT as xpMaterial
dim shaderGeneral, shaderSelectivo, shaderNY, shaderSP, shaderST, shaderBT as xpBaseShader
Self.GetObjectbyName("indiceGeneral", indiceGeneral)
Self.GetObjectbyName("indiceSelectivo", indiceSelectivo)
Self.GetObjectbyName("indiceNY", indiceNY)
Self.GetObjectbyName("indiceSP", indiceSP)
Self.GetObjectbyName("indiceST", indiceST)
Self.GetObjectbyName("indiceBT", indiceBT)
Self.GetObjectbyName("iconoGeneral", iconoGeneral)
Self.GetObjectbyName("iconoSelectivo", iconoSelectivo)
Self.GetObjectbyName("iconoNY", iconoNY)
Self.GetObjectbyName("iconoSP", iconoSP)
Self.GetObjectbyName("iconoST", iconoST)
Self.GetObjectbyName("iconoBT", iconoBT)
'#################################### Indice General #################################################
if inStr(indiceGeneral.text, "+") = 1 then
Engine.getMaterialByName ("matGeneral", MatGeneral)
MatGeneral.getShaderByName ("shaderGeneral", ShaderGeneral)
ShaderGeneral.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha arriba.png")
ShaderGeneral.reloadfile
elseIf inStr(indiceGeneral.text, "-" ) = 1 then
Engine.getMaterialByName ("matGeneral", MatGeneral)
MatGeneral.getShaderByName ("shaderGeneral", ShaderGeneral)
ShaderGeneral.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha abajo.png")
ShaderGeneral.reloadfile
Else
iconoGeneral.visible ="false"
end if
'#################################### Indice Selectivo #################################################
if inStr(indiceSelectivo.text, "+") = 1 then
Engine.getMaterialByName ("matSelectivo", MatSelectivo)
MatGeneral.getShaderByName ("shaderSelectivo", ShaderSelectivo)
ShaderSelectivo.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha arriba.png")
ShaderSelectivo.reloadfile
elseIf inStr(indiceSelectivo.text, "-" ) = 1 then
Engine.getMaterialByName ("matSelectivo", MatSelectivo)
MatSelectivo.getShaderByName ("shaderSelectivo", ShaderSelectivo)
ShaderSelectivo.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha abajo.png")
ShaderSelectivo.reloadfile
Else
iconoSelectivo.visible ="false"
end if
'#################################### Nueva York #################################################
if inStr(indiceNY.text, "+") = 1 then
Engine.getMaterialByName ("matNY", MatNY)
MatNY.getShaderByName ("shaderNY", ShaderNY)
ShaderNY.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha arriba.png")
ShaderNY.reloadfile
elseIf inStr(indiceNY.text, "-" ) = 1 then
Engine.getMaterialByName ("matNY", MatNY)
MatNY.getShaderByName ("shaderNY", ShaderNY)
ShaderNY.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha abajo.png")
ShaderNY.reloadfile
Else
iconoNY.visible ="false"
end if
'#################################### Sao Paulo #################################################
if inStr(indiceSP.text, "+") = 1 then
Engine.getMaterialByName ("matSP", MatSP)
MatSP.getShaderByName ("shaderSP", ShaderSP)
ShaderSP.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha arriba.png")
ShaderSP.reloadfile
elseIf inStr(indiceSP.text, "-" ) = 1 then
Engine.getMaterialByName ("matSP", MatBT)
MatSP.getShaderByName ("shaderSP", ShaderBT)
ShaderSP.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha abajo.png")
ShaderSP.reloadfile
Else
iconoSP.visible ="false"
end if
'#################################### Santiago #################################################
if inStr(indiceST.text, "+") = 1 then
Engine.getMaterialByName ("matST", MatST)
MatST.getShaderByName ("shaderST", ShaderST)
ShaderST.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha arriba.png")
ShaderST.reloadfile
elseIf inStr(indiceST.text, "-" ) = 1 then
Engine.getMaterialByName ("matST", MatST)
MatST.getShaderByName ("shaderST", ShaderST)
ShaderST.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha abajo.png")
ShaderST.reloadfile
Else
iconoST.visible ="false"
end if
'#################################### Bogota #################################################
if inStr(indiceBT.text, "+") = 1 then
Engine.getMaterialByName ("matBT", MatBT)
MatBT.getShaderByName ("shaderBT", ShaderBT)
ShaderBT.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha arriba.png")
ShaderBT.reloadfile
elseIf inStr(indiceBT.text, "-" ) = 1 then
Engine.getMaterialByName ("matBT", MatBT)
MatBT.getShaderByName ("shaderBT", ShaderBT)
ShaderBT.setFileName (Engine.ProjectPath &"Imagesindicadoresflecha abajo.png")
ShaderBT.reloadfile
Else
iconoBT.visible ="false"
end if
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I think is a long script because I have six items, with six different materials and the script is assigning an up or down arrow for each material (is for stocks), What I want is to have only two materials (one for up and one for down), and then assign the materials to my items when certain conditions are true.
Is there a way to make the script smaller with what I want?
thank you in advance.