runaway scripts

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
dbj87jb
Posts: 95
Joined: Tue Nov 04, 2014 8:59 am

runaway scripts

Post by dbj87jb »

what are run away scripts? trying to get a thing count script to run... tried 2 all ready and they've worked fine on a test level...

/5x Zombieman tagged 1 floor lower
script "1. Trooper Killed/Floor Lower" open
{
While(ThingCountName("Zombieman",1) > 0)
delay (35);
Floor_LowerToLowest(1,10);
print(s:"5x Zombieman Killed");
delay (75);
}
//3x Imp tagged 2 Door Open
script "DoomImp killed/Door Open" open
{
While(ThingCountName("DoomImp",2) > 0)
delay (35);
Generic_Door(2,64,1,0,0);
print(s:"3x Imp Killed");
}

on a level im making now im using this

//Exit
script "7. Exit Opening" open
{
While(ThingCountName("Archvile",34) > 0)
Floor_LowerToNearest(33,32);
Floor_LowerToNearest(34,32);
Print(s:"Once you've killed the Archviles");
delay (75);
print(s:"Then I suggest you\nget the f**k out of here!!");
delay (150);
}

and for some reason this is not working-- an error message "Runaway Script 7 Exit-- Terminated" at the top is claiming it's a runaway script, it verified it when it tested it in the editor but it doesn't work when testing the level...

UDMF Format
Last edited by dbj87jb on Mon Jan 05, 2015 1:37 pm, edited 2 times in total.
User avatar
MaxED
Posts: 2246
Joined: Tue Feb 28, 2012 12:55 pm

Re: runaway scripts

Post by MaxED »

Here's your Exit script, with proper bracing:

Code: Select all

//Exit
script "7. Exit Opening" open
{
    While(ThingCountName("Archvile",34) > 0)
    {
        Floor_LowerToNearest(33,32); // <- Look! No delay! Infinite loop imminent!
    }
    
    Floor_LowerToNearest(34,32);
    Print(s:"Once you've killed the Archviles");
    delay (75);
    print(s:"Then I suggest you\nget the f**k out of here!!");
    delay (150);
}
 
dbj87jb
Posts: 95
Joined: Tue Nov 04, 2014 8:59 am

Re: runaway scripts

Post by dbj87jb »

[quote="MaxED"]Here's your Exit script, with proper bracing:

Code: Select all


Thanks... but it's still not working-- re-checked all the tags, so they match... but as soon as the level starts it comes up with the same message
"Runaway Script 7 Exit-- Terminated"...

I've tried making the script void but when the trigger to start it has been activated- it still fails
User avatar
MaxED
Posts: 2246
Joined: Tue Feb 28, 2012 12:55 pm

Re: runaway scripts

Post by MaxED »

zdoom.wiki wrote:Please note that looping a script without a delay will cause ZDoom to automatically terminate the script, because it would not give anything else in the map a chance to run. This is determined by counting the amount of actions called by the script and terminating if the amount reaches 500,000. Some functions, like distance, can hit this limit when called in a large for loop.
You need to add a delay inside of your While statement.
Also, you need to learn some ACS basics...

Code: Select all

//Exit
script "7. Exit Opening" open
{
    While(ThingCountName("Archvile",34) > 0)
    {
        Floor_LowerToNearest(33,32);
        delay (75); // <- A delay! Like this one!
    }
    
    Floor_LowerToNearest(34,32);
    Print(s:"Once you've killed the Archviles");
    delay (75);
    print(s:"Then I suggest you\nget the f**k out of here!!");
    delay (150);
}
dbj87jb
Posts: 95
Joined: Tue Nov 04, 2014 8:59 am

Re: runaway scripts

Post by dbj87jb »

MaxED wrote:
zdoom.wiki wrote:Please note that looping a script without a delay will cause ZDoom to automatically terminate the script, because it would not give anything else in the map a chance to run. This is determined by counting the amount of actions called by the script and terminating if the amount reaches 500,000. Some functions, like distance, can hit this limit when called in a large for loop.
You need to add a delay inside of your While statement.
Also, you need to learn some ACS basics...

All that's done is repeat the "print" message about 5 times then the script was terminated... as for "learning the basics"... it is looping scripts, like this, that i'm only having difficulties with now... although at the moment I'm frustrated at the fact that it's worked fine on a test map i set up and for some reason, it's not now...

mind you... some extra demo maps and better explanation for scripts like this, on the website wouln't go a miss
User avatar
MaxED
Posts: 2246
Joined: Tue Feb 28, 2012 12:55 pm

Re: runaway scripts

Post by MaxED »

dbj87jb wrote:some extra demo maps ... wouln't go a miss
Here you go...
Attachments
impkiller.wad
(7.88 KiB) Downloaded 28 times
dbj87jb
Posts: 95
Joined: Tue Nov 04, 2014 8:59 am

Re: runaway scripts

Post by dbj87jb »

One of the thing I have also noticed is that after using 60 lines of scripts have been added, anything added after doesn't work on the map... a huge chunk was used for patrol point set ups (I know about patrol points and commands for them... I HAVE read about that all ready)... does anybody else have this problem?

Full script (excluding the attempted ArchVile and before that Cyberdemon counter scripts)--- level is a modified version of "The Crusher"
Last edited by dbj87jb on Tue Jan 06, 2015 7:04 am, edited 1 time in total.
dbj87jb
Posts: 95
Joined: Tue Nov 04, 2014 8:59 am

Re: runaway scripts

Post by dbj87jb »

Code: Select all

=php
#include "zcommon.acs"

//Mission 06
script "1. Mission" open
{
delay (75);
print(s:"Mission 06: The Crusher Compound");
delay (150);
}
//Switch 1 (Tag 1+5)
script "2. Crusher 1" (void)
{
Ceiling_CrushRaiseAndStayA(1,16,32,100,0);
Floor_LowerByValue(5,50,64);
}
//Switch 2 (Tag 2+6)
script "3. Crusher 2" (void)
{
Ceiling_CrushRaiseAndStayA(2,16,32,100,0);
Floor_LowerByValue(6,50,64);
}
//Switch 3 (Tag 3+5)
script "4. Crusher 3" (void)
{
Ceiling_CrushRaiseAndStayA(3,16,32,100,0);
Floor_LowerByValue(5,50,64);
}
//Switch 4 (Tag 4+6)
script "5. Crusher 4" (void)
{
Ceiling_CrushRaiseAndStayA(4,16,32,100,0);
Floor_LowerByValue(6,50,64);
}
//6 Patrolling Railgun Z-Secs across 12 Routes
script "6. Railgun Z-Sec Patrol Routes" open
{
Thing_SetGoal(7,3,1,0);
Thing_SetGoal(8,4,1,0);
Thing_SetGoal(9,5,1,0);
Thing_SetGoal(9,8,1,0);
Thing_SetGoal(14,10,1,0);
Thing_SetGoal(15,11,1,0);
Thing_SetGoal(16,12,1,0);
Thing_SetGoal(16,13,1,0);
Thing_SetGoal(21,17,1,0);
Thing_SetGoal(22,18,1,0);
Thing_SetGoal(23,19,1,0);
Thing_SetGoal(23,20,1,0);
Thing_SetGoal(28,24,1,0);
Thing_SetGoal(29,25,1,0);
Thing_SetGoal(30,26,1,0);
Thing_SetGoal(30,27,1,0);
}
//Megasphere Marine
script "7. Megasphere Marine" (void)
{
Spawnspot("Megasphere",38,83,0);
print(s:"Cha-ching!!!");
delay (75);
}
//Backpacker 1
script "8. Backpacker 1" (void)
{
Spawnspot("Backpack",37,144.0);
print(s:"He didn't need it anyway");
delay (75);
}
//Backpacker 2
script "9. Backpacker 2" (void)
{
Spawnspot("Backpack",36,144,0);
Spawnspot("Backpack",36,144,0);
print(s:"He didn't need it anyway");
delay (75);
}
//Backpacker 3
script "10. Backpacker 3" (void)
{
Spawnspot("Backpack",2,144,0);
print(s:"He didn't need it anyway");
delay (75);
}
Last edited by dbj87jb on Tue Jan 06, 2015 12:58 pm, edited 9 times in total.
dbj87jb
Posts: 95
Joined: Tue Nov 04, 2014 8:59 am

Re: runaway scripts

Post by dbj87jb »

The commands for the "Backpackers" are at Lines 61 onwards... when I tried to set up the Archvile scripts, they went over 60, and so did a Cyberdemon killing script (added before the Archvile script as a separate number)... both were meant to be set up- like Phobos Anomoly or Dead Simple work-- you killed all tagged enemies the the next starts-- but both went over 60. Even when taking the Cyberdemon scripts out (because there's 8 under 8 seperate Crushers) the scripts went over 60.

All script commands for most of the crushers were set up normally with using script editor so they weren't clogging up the space. 12 in total only 4 needed to be edited in script editor because they lowered platforms as well
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: runaway scripts

Post by Gez »

Please use code tags.
dbj87jb
Posts: 95
Joined: Tue Nov 04, 2014 8:59 am

Re: runaway scripts

Post by dbj87jb »

Gez wrote:Please use code tags.
What are "code tags?" :?: There's no mention about that anywhere online or in the editor...

if your referring to the spawning items, the backpack's item number is 144 so they should be appearing... the mega-sphere spawns fine, there's 4 Mapspots for each item to appear on, each of them are tagged separately but anything past line 60 (//Backpacker 1) on the script doesn't work...
User avatar
Ichor
Posts: 1784
Joined: Wed Jul 23, 2003 9:22 pm

Re: runaway scripts

Post by Ichor »

He means the forum code tags to make the script easier for everyone to read.

Code: Select all

#include "zcommon.acs"

//Mission 06
script "1. Mission" open
{
    delay (75);
    print(s:"Mission 06: The Crusher Compound");
    delay (150);
}
//Switch 1 (Tag 1+5)
script "2. Crusher 1" (void)
{
    Ceiling_CrushRaiseAndStayA(1,16,32,100,0);
    Floor_LowerByValue(5,50,64);
}
//Switch 2 (Tag 2+6)
script "3. Crusher 2" (void)
{
    Ceiling_CrushRaiseAndStayA(2,16,32,100,0);
    Floor_LowerByValue(6,50,64);
}
//Switch 3 (Tag 3+5)
script "4. Crusher 3" (void)
{
    Ceiling_CrushRaiseAndStayA(3,16,32,100,0);
    Floor_LowerByValue(5,50,64);
}
//Switch 4 (Tag 4+6)
script "5. Crusher 4" (void)
{
    Ceiling_CrushRaiseAndStayA(4,16,32,100,0);
    Floor_LowerByValue(6,50,64);
}
//6 Patrolling Railgun Z-Secs across 12 Routes
script "6. Railgun Z-Sec Patrol Routes" open
{
    Thing_SetGoal(7,3,1,0);
    Thing_SetGoal(8,4,1,0);
    Thing_SetGoal(9,5,1,0);
    Thing_SetGoal(9,8,1,0);
    Thing_SetGoal(14,10,1,0);
    Thing_SetGoal(15,11,1,0);
    Thing_SetGoal(16,12,1,0);
    Thing_SetGoal(16,13,1,0);
    Thing_SetGoal(21,17,1,0);
    Thing_SetGoal(22,18,1,0);
    Thing_SetGoal(23,19,1,0);
    Thing_SetGoal(23,20,1,0);
    Thing_SetGoal(28,24,1,0);
    Thing_SetGoal(29,25,1,0);
    Thing_SetGoal(30,26,1,0);
    Thing_SetGoal(30,27,1,0);
}
//Megasphere Marine
script "7. Megasphere Marine" (void)
{
    Spawnspot("Megasphere",38,83,0);
    print(s:"Cha-ching!!!");
    delay (75);
}
//Backpacker 1
script "8. Backpacker 1" (void)
{
    Spawnspot("Backpack",37,144.0);
    print(s:"He didn't need it anyway");
    delay (75);
}
//Backpacker 2
script "9. Backpacker 2" (void)
{
    Spawnspot("Backpack",36,144,0);
    Spawnspot("Backpack",36,144,0);
    print(s:"He didn't need it anyway");
    delay (75);
}
//Backpacker 3
script "10. Backpacker 3" (void)
{
    Spawnspot("Backpack",2,144,0);
    print(s:"He didn't need it anyway");
    delay (75);
}
User avatar
Kappes Buur
 
 
Posts: 4182
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: runaway scripts

Post by Kappes Buur »

Spoiler:
Highlight the code which is to be code tagged and clicking on Code you get this result:

Code: Select all

#include "zcommon.acs"

//Mission 06
script "1. Mission" open
{
delay (75);
print(s:"Mission 06: The Crusher Compound");
delay (150);
}
//Switch 1 (Tag 1+5)
script "2. Crusher 1" (void)
{
Ceiling_CrushRaiseAndStayA(1,16,32,100,0);
Floor_LowerByValue(5,50,64);
}

...... etc
If you want to display your code highlighted, then click on Code and add =php to the first tag,
for example code=php and you get this result:

Code: Select all

#include "zcommon.acs"

//Mission 06
script "1. Mission" open
{
delay (75);
print(s:"Mission 06: The Crusher Compound");
delay (150);
}
//Switch 1 (Tag 1+5)
script "2. Crusher 1" (void)
{
Ceiling_CrushRaiseAndStayA(1,16,32,100,0);
Floor_LowerByValue(5,50,64);
}

...... etc
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: runaway scripts

Post by cocka »

after using 60 lines of scripts have been added
Why do you need so many scripts? :roll:
Locked

Return to “Editing (Archive)”