Text popup box for set time question...

DigiChainDigiChain Member, PRO Posts: 1,288
edited February 2012 in Working with GS (Mac)
For some reason I'm struggling with this.

I have a pop-up box that displays different text depending on which actor you click on screen.
I want it to display for 3 seconds and then disappear -

so in the actor I click I have a rule that changes a boolean attribute TextDisplay to 1.
And a timer - After 3 seconds change TextDisplay to 0.

Works fine - until I click a 2nd actor with the same rule and the 3 second timer doesn't reset, so I may only have a flash of the text the 2nd actor triggers (because the timer is still being used from that 1st actor)

Can anyone help? Sorry, difficult to explain - hope it makes sense.

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Maybe make a different attribute for each actor and see if that fixes your problem.

    Bray
  • MotherHooseMotherHoose Member Posts: 2,456
    and I do not like to use spawn a lot … but this seems to call for it

    gameAttribute … text type… text2Display

    Actor1
    Rule: when
    Event: touch is pressed
    --changeAttribute: game.text2Display To: this actor's text
    --spawn textActor

    (add with correctText for all the touchable actors … )

    textActor:
    Display Text … Text: game.text2Display
    Rule: when
    Attribute: self.Time = 3
    --Destroy

    @};- MH
  • DigiChainDigiChain Member, PRO Posts: 1,288
    Cheers guys - but I'm sure there has to be an easier way.
    The problem is with the timer.

    Here's what I have currently:
    RULE: When Actor receives Touch
    --changeAttribute: game.textBox to: tableCellvalue....
    --changeAttribute: game.TextBoxDisplay to TRUE
    -- Timer> After 3 secs change game.TextBoxDisplay to FALSE

    The problem is that if I touch it again within the 3 second timer it doesn't restart the 3 secs count. And therefore if touching another scene object that triggers text display in the same box, it may just flash briefly on-off if the original 3 sec count is coming to an end.

    If I can find a way of making this work it'll save a huge amount of work down the line because the Text Box actor will be a single Prototype used in all scenes and the text to be displayed will just be pulled from a table.
Sign In or Register to comment.