Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Chaos1987 on Thu 17/05/2007 23:51:57

Title: Label color change in peroid of time
Post by: Chaos1987 on Thu 17/05/2007 23:51:57
Does anyone know how to:

I have a status bar that shows Walk to *** or Look at *** and so on. I want to make text change color for the time between the moment of mouse click until player finishes walking or interactig or other things.
Some ideas?
Title: Re: Label color change in peroid of time
Post by: Khris on Fri 18/05/2007 00:40:06
I have absolutely no idea how your code looks like, but I'll try anyway:

Change the color to highlighted right before calling ProcessClick/RunInteraction (presumably in on_mouse_click).

Change the color back to normal in repeatedly_execute.

Since calls to RunInteraction are blocking, rep_ex won't run during that time, thus the bar will be highlighted right until rep_ex gets called again i.e. the player is back in control.

(At least that's how an LA-template I frequently use does it, and it works like a charm.)
Title: Re: Label color change in peroid of time
Post by: Chaos1987 on Fri 18/05/2007 14:02:57
Well, I did it other way.

if((player.Speaking == true) || (player.Moving == true) || (player.Animating == true))
        { labeltext.TextColor = 63488; }
else {labeltext.TextColor = 15;}

put in the repeatedly_execute_always section.
Title: Re: Label color change in peroid of time
Post by: Khris on Fri 18/05/2007 15:19:43
1. You don't need ==true, if (player.Moving || ... is enough.

2. What if there's a scene where the player's doing none of those things?

If you don't want advice, don't open a thread asking for it.
Title: Re: Label color change in peroid of time
Post by: Chaos1987 on Fri 18/05/2007 15:55:10
I post it, when i didnt know how to. After some sleep and study I menage to do it. I only wanted to give it to others.
Oh, and scens without moving, talking or animating are not needed for status line to change color.
Title: Re: Label color change in peroid of time
Post by: Khris on Fri 18/05/2007 16:50:19
Well, think of the player having a conversation. While the other char is talking, the player will neither move nor speak nor animate. So the verb line will light down, light up, light down, light up, duting the entire conversation.
Title: Re: Label color change in peroid of time
Post by: Chaos1987 on Fri 18/05/2007 16:57:37
gui and status line will disappear while a conversation :)