[SOLVED] How to do a Repeatedly_Execute_Always() function in a room script?

Started by Snake, Sun 01/06/2008 23:04:39

Previous topic - Next topic

Snake

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?
Code: ags

#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.
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

skuttleman

You just have to make a function in the room script separate from whatever other functions you have going on.
Code: ags

...
function repeatedly_execute_always()
{
  // Do whatever
}
...

Snake

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
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

skuttleman

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.

Khris

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.

Snake

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
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

SMF spam blocked by CleanTalk