Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Snake on Sun 01/06/2008 23:04:39

Title: [SOLVED] How to do a Repeatedly_Execute_Always() function in a room script?
Post by: Snake on Sun 01/06/2008 23:04:39
To avoid looking like a complete idiot, I searched and searched the manual - I even googled it - but I can't find the answer.

How do you put repeatedly_execute_always() in the room script?

I know how to do it in the global script, but this seems to confuse me.

I'm afraid I'm going to corrupt my game since when I look in the script editor of the room there's a bunch of lines that say "do not edit or remove this line".

Do I create a new segment like this one?

#sectionstart room_c  // DO NOT EDIT OR REMOVE THIS LINE
function room_c() {
  // script for Room: Repeatedly execute


If so, I'm sorry, but I just don't get it. The manual doesn't explain to me HOW to put this in a room - it just says that I can.

Thank you,


--Snake

Please, help will be super appreciated.
Title: Re: How to do a Repeatedly_Execute_Always() function in a room script?
Post by: skuttleman on Sun 01/06/2008 23:08:55
You just have to make a function in the room script separate from whatever other functions you have going on.

...
function repeatedly_execute_always()
{
  // Do whatever
}
...
Title: Re: How to do a Repeatedly_Execute_Always() function in a room script?
Post by: Snake on Sun 01/06/2008 23:22:47
I'm sorry, please bare with me.

How do I do that? Where do I place it, I guess is what I'm asking.
There's a bunch of sectionstarts and sectionends. Do I make one of those?

I'm opening the script editor, the button that looks like this "{}" and it displays every script. Where in the interactions do I place this?


--Snake
Title: Re: How to do a Repeatedly_Execute_Always() function in a room script?
Post by: skuttleman on Sun 01/06/2008 23:27:03
you don't need an interaction. You don't need a section. Just place it at the very bottom of the room script. It's easier than you're making it.
Title: Re: How to do a Repeatedly_Execute_Always() function in a room script?
Post by: Khris on Sun 01/06/2008 23:30:16
Outside any interaction.
The sectionstart/end stuff is there to keep newbies from editing the functions that are managed by AGS, i.e. added, named & removed by the editor after one adds a RunScript action to an event (or removes it again).

You can put the function anywhere in the room script, as long as it's between sectionend of the previous and sectionstart of the next function (in that order), or at the very beginning/end.
Title: Re: How to do a Repeatedly_Execute_Always() function in a room script?
Post by: Snake on Sun 01/06/2008 23:59:49
Thank you, Skuttleman and Kris.

It's just overwhelming to look at. It just seemed to me that there was just nowhere to put it, leaving me at, "Where the hell do I put this?!"

Thanks again,


--Snake