Repeatstyle

Started by dbuske, Tue 08/03/2011 14:53:19

Previous topic - Next topic

dbuske

I checked the documentation and couldn't find how to use the REPEATSTYLE optional parameter.

AudioChannel* AudioClip.Play(optional AudioPriority, optional RepeatStyle)

This is one of the problems I have run into, frequently the program help files don't go into enough detail.  Optional parameters are frequently not shown.
What is the actual REPEATSTYLE parameter explanation?

room_RepExec() is already used in the room, so I need a way to keep an ambient sound (spaceship engine sound) to keep running why the dialog is running.
I thought repeat style would work under the play function.  Here is the script.

// room script file

function room_RepExec()
{
player.ChangeRoomAutoPosition(2, 2000 +400);   \\the main character is set to not be shown in this room.
}

function room_Load()
{
aAmbient_engine_3.Play();
}

function room_AfterFadeIn()
{
dintro.Start();
}
What if your blessings come through raindrops
What if your healing comes through tears...

Khris

As soon as you have typed "aAmbient_engine_3.Play(", the autocomplete window kicks in, offering the possible choices for both parameters.

To be specific, after you have chosen the priority using Enter and typed the comma, it's going to show eOnce and eRepeat.

Naturally, you can only skip optional parameters starting from the end, so you have to provide the priority in order to use eRepeat.

Btw, in your code you're sending the player to room 2 40 times per second.
In order to hide the player, just move them off-screen:
Code: ags
  player.y = -1;

Ishmael

I thought there was a variable for turning characters 'off' but apparently it's gone nowdays.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

monkey0506

Well there's several methods for hiding the player character.

The simplest is to use the "ShowPlayerCharacter" setting in the room's properties pane.

Another way, as Khris has shown, is to set the player to an off-screen location.

You could also use Character.Transparency to make the character fully transparent.

Or you could create a view that has only a single frame in each loop, each frame with a fully transparent sprite, and then use Character.ChangeView.

Finally, there is one unofficial, unsupported method that should not be used by anyone who isn't willing to accept the consequences of toying around with the internal workings of AGS, and could quite possibly create quite a lot of problems for themselves by doing so, and that would be the hidden Character.on property. It's hidden because you're not supposed to know that it's there, because you're not supposed to use it. For all intents and purposes, it serves the same function as what a proposed Character.Visible property would, with the important exception that since it is unsupported, it might not always work right. It is used internally for this purpose, but it hasn't been thoroughly tested enough to make it available for public consumption..probably because of the number of other ways of accomplishing the same thing..and other tasks which were simply higher priority.

dbuske

Thanks for the help.
I fixed the problem with eRepeat.
I am now going to move the character out of the room with player.y = -1;
Much thanks
What if your blessings come through raindrops
What if your healing comes through tears...

monkey0506

Regarding moving the player off-screen, I just want to make sure you're also aware that you do not need to do that repeatedly. Putting it in the room_Load function should be sufficient.

For future reference, when you see an optional parameter like "RepeatStyle", try searching for it in the manual. Searching for "RepeatStyle" lists the page "Built-in enumerated types" as the second in the list, and highlights the term within the page. Then you can see that it's an enum with the possible values of "eOnce" or "eRepeat". ;)

Gilbert

Quote from: Ishmael on Tue 08/03/2011 15:25:35
I thought there was a variable for turning characters 'off' but apparently it's gone nowdays.

You are talking about the 'on' property I think. I just tested and it still works in V3.12 at least.
(say, use player.on=false; to make the player character disappear.)
However, this feature is never supported (it is not referenced in the manual and will not appear with the auto-complete function of the script editor), so use at your own risk as it is not always guaranteed to work.

Ishmael

Quote from: Iceboty V7000a on Wed 09/03/2011 01:28:42
Quote from: Ishmael on Tue 08/03/2011 15:25:35
I thought there was a variable for turning characters 'off' but apparently it's gone nowdays.

You are talking about the 'on' property I think. I just tested and it still works in V3.12 at least.
(say, use player.on=false; to make the player character disappear.)
However, this feature is never supported (it is not referenced in the manual and will not appear with the auto-complete function of the script editor), so use at your own risk as it is not always guaranteed to work.

Oh my, yes, that is what I meant, and I tried it but it didn't seem to work... Although, might've been I tried 'On' and never thought to uncaps it. But cool :=
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

SMF spam blocked by CleanTalk