Still a Simple ACS question

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
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Still a Simple ACS question

Post by Siggi »

I'm using this script to end the level when all the monsters have been killed (allong with displaying a hud message).

Code: Select all

script 2 OPEN
{
while(True)
	{
	delay(2);
	if (GetLevelInfo(LEVELINFO_KILLED_MONSTERS) == GetLevelInfo(LEVELINFO_TOTAL_MONSTERS))
		{
		setfont ("BIGFONT");
		hudmessage(s:"Level Complete"; HUDMSG_PLAIN, 0, CR_WHITE, 0.5, 0.5, 0);
		delay (120);
		Teleport_NewMap (1, 0, 0);
		}
	}
}
now what I'm wondering is:
Why does it not work without the delay in it.
(when there was no delay it simply did nothing when all the monsters were dead, but then for debugging purposes I put in an else statement that simply printed "stuff", and I noticed it didn't continue printing the message indefinitely)
So, i'm also wondering, if the script stopped working after a sertain length of time when there was no dilay, will this script with the delay in it allways work?

(if something in what I said is unclear, please say so)
Last edited by Siggi on Tue Mar 01, 2005 3:29 pm, edited 1 time in total.
Costja
Posts: 188
Joined: Mon Oct 18, 2004 3:58 pm
Location: Russia, Moscow
Contact:

Re: Simple ACS question..

Post by Costja »

Psycho Siggi wrote:

Code: Select all

script 2 OPEN
{
while(True)
	{
	delay(2);
...
This delay is required because
ACS - ZDoom Wiki wrote: Please note that looping a script without a delay will cause ZDoom to automatically terminate the script, because it won't give anything else in the map a chance to run. You will see a message like the following when this happens:

Code: Select all

Runaway script 1 terminated
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Oh my,,, I can't believe I missed that.
So then the one with the delay will allways work.. cool.

One other thing, I have done somethig similar to get a message to appear at the top of the screen that shows the amount of monsters you've killed and the ammount of monsters in total.

Code: Select all

script 4 OPEN
{
while (True)
	{
	setfont ("BIGFONT");
	hudmessage(s:"monsters:", d:GetLevelInfo(LEVELINFO_KILLED_MONSTERS),s:"/",d:GetLevelInfo(LEVELINFO_TOTAL_MONSTERS); HUDMSG_PLAIN, 0, CR_WHITE, 0, 0, 0.1);
	delay (2);
	}
}
now this code works fine,,, but I'm wondering if there is a better way to do this?
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

*cough cough*
I wouldn't normally bump a thread, but I'd apreciate some info...
User avatar
Phoenix
Posts: 344
Joined: Tue Sep 28, 2004 4:49 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Location: Canada

Post by Phoenix »

looks like a fine way to do it to me. i'm not sure how you can make it any 'better'.
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Hmmmm, I just don't like the way it updates itself even though there has been no changes to the information.

I've allways thought there would be a more efficient way of doing that that I didn't know about,,, obviously I guessed wrong ;)
User avatar
Phoenix
Posts: 344
Joined: Tue Sep 28, 2004 4:49 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Location: Canada

Post by Phoenix »

oh, that.. well, it's probably possible to make it only update when new information is gotten, but that would take more code than you've got there and probably not be worth it really. as long as the hudmessage isn't logging itself to the console or displaying weirdly when it updates or something, no one's gonna know ;)
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Heh, I guess you have a point there...
As long as it doesn't cause huge lag I'll just live with it (and no, I didn't have any performance issues with that script ;))
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Psycho Siggi wrote:Hmmmm, I just don't like the way it updates itself even though there has been no changes to the information.

I've allways thought there would be a more efficient way of doing that that I didn't know about,,, obviously I guessed wrong ;)

These updates don't cost much. The thing that takes the most time is to draw the text and that has to be done anyway.
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

I'll consider my questions answered.
Untill I find more that is...
Locked

Return to “Editing (Archive)”