Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Sequential Looping Script
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#1
Sequential Looping Script

All righty, so here's the deal:

I'm putting together a quick little credits sequence, using the SetMessage function (I find that it looks nicer than gimping/photoshopping them), and it's not really turning out. There are five messages altogether.

void ToBlack(string &in asTimer)
{
    FadeOut(5);
    TeleportPlayer("PlayerStartArea_11");
    
    AddTimer("", 5, "CreditsRoll");
}

void CreditsRoll(string &in asTimer)
{
    for(int i = 1; i <= 5; i++) {
        FadeIn(5);    
        SetMessage("Messages", "credits_"+i, 5);
        AddLocalVarInt("Roll", 1);
        
        if (GetLocalVarInt("Roll") == 5)
             {
                RemoveTimer("CreditsRoll");
             }
            }
            
    AddTimer("", 5, "CreditsRoll");
}

Each message is named credits_1 and is sequential, but for the life of me, it's just not coming together, and I betcha it's an easy fix too. -.-

08-22-2015, 11:43 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Sequential Looping Script

You're using the for-loop in an interesting way.

I'm not sure what you were picturing, but I would do something like

PHP Code: (Select All)
void CreditsRoll(string &in asTimer)
{
AddLocalVarInt("Roll"1//Add 1 to a variable, so it keeps rising.

SetMessage("Messages""credits_"+GetLocalVarInt("Roll"), 5//Show the message, with the added variable.

if(GetLocalVarInt("Roll") < 5//If less than 5, add another timer
{
AddTimer(""5"CreditsRoll");
}


EDIT: Forgot a category in SetMessage

Trying is the first step to success.
(This post was last modified: 08-22-2015, 12:10 PM by FlawlessHappiness.)
08-22-2015, 12:07 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Sequential Looping Script

A for-loop does not have any delay to it. If you set it to loop 10 times, it will finish all those 10 times before anything else happens in the game. If it's process-heavy, it will freeze the game rather than do it delayed.

08-22-2015, 12:38 PM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#4
RE: Sequential Looping Script

Hiphiphooray!! Thank you Flawless, that worked perfectly!

08-22-2015, 07:07 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Sequential Looping Script

(08-22-2015, 07:07 PM)AGP Wrote: Hiphiphooray!! Thank you Flawless, that worked perfectly!

Aw yiss! Big Grin Great to hear!

Trying is the first step to success.
08-22-2015, 07:46 PM
Find




Users browsing this thread: 1 Guest(s)