Radio playing in background of a room in my game!

Started by ggss, Mon 06/12/2004 21:11:30

Previous topic - Next topic

ggss

I am trying to create a radio playing in the background of a room in my game, and I figure it needs to be non-blocking, so that the user can still play the game while the radio is playing. I have managed to create guis that have labels that change over time, but not in a non-blocking way.Ã,  The only methods that have worked for me so far are blocking, and of course, this is not what I want. I want the text from the radio to show on the background
(and I will probably put sound with it later). I have been able to achieve this, but I wasn't able to achieve it without blocking the rest of the game.Ã,  I tried learning how to track the passage of time, and I have read the manual alot, and I have studied variables a bit, and tried using variables, but I may not be doing it correctly. Can anyone help? I have tentatively decided on either a transparent gui with label text that changes over time, or I might use RawPrint, and RawDrawImage(non-blocking)(RawSaveScreen and RawRestoreScreen too).Ã,  So, the main problem with doing this with the family of Raw's is that I haven't figured out how to track the passage of time, and how to make events occur at specified intervals of time. It is frustrating me, because I thought it would be relatively easy to do, but I have spent much time on trying to figure this out.Ã,  I would like to do this the easiest way possible, and if you can help it would be greatly appreciated. Thank you.

Candle

Kind of lost me here .you want to have a radio playing music in the background but you want to use gui to do it ?

Ashen

 think the GUI thing was just an example of something he's tried to do.
Let me see if I've got this:
You want to have speech displayed as if coming from a radio (like subtitles for the song / announcer that's playing), and you want what's displayed to change with time, but you want it to be non-blocking?

If so:
For a non-blocking equivilant to Wait() see this thread: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=18027.0 (I actually think it was your question then, as well.) Just remember to declare the variable in the room or global script (depending on whether you want it to measure time across the whole game, or just in one room), and NOT in rep-ex. Basicly a variable is added to in the background, and events are triggered when it reaches certain points.
For a non-blocking way to display speech - look up DisplaySpeechBackground(). Of course, this means you'll have to use a character as the radio, but I think it's the best way to do it. You might also want to look up CreateTextOverlay and related functions. If these fail, then of course using a transparent GUI remains a possibility.
I know what you're thinking ... Don't think that.

ggss

I guess the main problem I am having is with tracking the passage of time, and then causing events to be triggered by this passage of time. I have tried it several different ways, and none of them worked. I think I might need some precise coding instructions that would guide me through it completely.  Perhaps just some code that tracked time for a bit, and then an event occurs, and then some more time goes by, and then another event occurs. That would probably be sufficient, and I think I could take it from there.
Thank you again, and it was me that posted that other one, Ashen.

Ashen

What wasn't precise about JBurger's code? I've created a little 'test game' to show you how to put it into effect. Look at the room script (Ctrl-E, or the '{}' button), and the repeatedly execute script (also visible in the room script):
http://www.geocities.com/whoismonkey/AGS/Time.zip
For the moment, it's limited to while the player's in one room (as that's all I did), but you'd just need to move the int declaration into the Global script, and the rep_ex script into the global rep-ex to make it follow you around the game.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk