General Discussion

 View Only
  • 1.  Designing a game and need script help (simple matching of data fields turns on visibility of answer)

    Posted 09-20-2024 13:28

    Imagine a game where a number of blank squares appear on the screen under a question, ala wheel of fortune. Contestant starts guessing letter rapid fire up to a max 0f 10 guesses. I have a dashboard that holds 27 buttons per row (A-Z and blank default). As the operator clicks on a given letter it sets Data1 value. Meanwhile the answer text is fed by an excel sheet. So, on OnSetText for the DATA1 field I have the following script.

    dim letter1 as xpTextObject
    dim letter1Vis as xpBaseObject
    dim Data1 as xpTextObject

    engine.getobjectbyname("LETTER 1",letter1)
    engine.getobjectbyname("LETTER 1",letter1Vis)
    engine.getobjectbyname("DATA_1", Data1)


    if Data1.text = letter1.Text then
    letter1Vis.Visible = true

    else
    letter1Vis.Visible = false

    end if

    A simple visibility switch based on whether two data field match. I think I am missing something simple and small. Helping out a fellow designer.

    Thanks in advance



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------


  • 2.  RE: Designing a game and need script help (simple matching of data fields turns on visibility of answer)

    Posted 09-20-2024 13:36

    I have also tried self.getobjectbyname  and I have tried if text = letter1.text. It works using visual logic but this could really bog down if the answer is a long one.



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 3.  RE: Designing a game and need script help (simple matching of data fields turns on visibility of answer)

    Posted 09-21-2024 11:16

    Where is this script running?

    Are you using the debug monitor to help you? 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 4.  RE: Designing a game and need script help (simple matching of data fields turns on visibility of answer)

    Posted 09-21-2024 11:27

    Hi Red,

    The script is on a text object "DATA_GUESS1". It is linked to a dashboard with 26 letters in the parameter and toggle buttons. It should compare it's value to the value of a text object in the scene that is the first letter of the answer. "TXT_Letter1". That text object is tied to an excel sheet. No, I haven't turned on debug. 



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 5.  RE: Designing a game and need script help (simple matching of data fields turns on visibility of answer)

    Posted 09-21-2024 11:34

    if it is running in a text object then the "self" would be the text object and "scene" would be the scene so it would be; 

    scene.getobjectbyname("LETTER 1",letter1)



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 6.  RE: Designing a game and need script help (simple matching of data fields turns on visibility of answer)

    Posted 09-21-2024 11:44

    Thank you Simon, I will give it a try. AND turn on debugging. Cheers



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------