BCC structs, libraries and a world scope array of structs

Discuss all aspects related to modding Zandronum here.
Post Reply
Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

BCC structs, libraries and a world scope array of structs

#1

Post by Lollipop » Sun Jan 11, 2015 4:57 pm

Hello fellow doomers, I have a very complicated issue.

first some technical information:
I am using the latest BCC compiler.
Everything compiles without errors

Now, the code snippets of importance:
Spoiler: Snippets from my library (Open)

Code: Select all

struct DOM_POINT {
	int Sector_Tag;
	int Points_Given;
	int Restart_Time;
	int BoP;
	int Blue_Max_Control;
	int Red_Max_Control;
	int Current_Team;
	int Prev_Team;
	struct DOM_AEST AEST;
	struct DOM_POINT_COLOR COLOR;
};

Code: Select all

world struct DOM_POINT 0:DOM_POINT_LIST[];

Code: Select all

	Delay(DOM_POINT_LIST[DPL_Slot].Restart_Time);
	restart;
Spoiler: Map code (small) (Open)

Code: Select all

#include "zcommon.acs"
#import "ACS_DOM.acs"

script 1 open {
	DOM_POINT_LIST[0].Sector_Tag = 1;
	DOM_POINT_LIST[0].Points_Given = 1;
	DOM_POINT_LIST[0].Restart_Time = 35;
	DOM_POINT_LIST[0].BoP = -16;
	DOM_POINT_LIST[0].Blue_Max_Control = 16;
	DOM_POINT_LIST[0].Red_Max_Control = -16;
	DOM_POINT_LIST[0].Current_Team = 901;
	
	DOM_POINT_LIST[0].AEST.Sector_Tag = 1;
	DOM_POINT_LIST[0].AEST.Fade = 1;
	
	acs_execute(801, 0, 0);
}

this is what happens:
  • Nothing appears to have happened when I load up the map.
  • When I manually run the script, it throws an error "runaway script 801 terminated"
Is this because I am using structs in a way they do not support?
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

User avatar
Dark-Assassin
Maintenence Crew
Posts: 968
Joined: Fri May 25, 2012 4:25 am

RE: BCC structs, libraries and a world scope array of structs

#2

Post by Dark-Assassin » Sun Jan 11, 2015 6:47 pm

I believe everything is processed per tic.
If so, at any time in a reoccurring loop, if there are a total of 0 tics (even if dynamic) delay, it will just runaway no matter what. There will be no game tics that would have passed in that time to update any strings/integers and how long the delay is supposed to be.

Perhaps try having a 1 tic delay just before the end or at the start of the loop and see if that works.
Last edited by Dark-Assassin on Sun Jan 11, 2015 6:49 pm, edited 1 time in total.
❗ Don't message me for technical or moderation support.
❔ Use the relevant support channels instead.

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: BCC structs, libraries and a world scope array of structs

#3

Post by Lollipop » Mon Jan 12, 2015 4:12 pm

I tried to test some different changes, and none of them seemed to work.
even made a "world int 1:stufftime[];" line in my library, and then changed it in the maps file, with no result of course.
Then, as if it fell from the sky, my code just randomly started working for absolutely no reason.

If someone comes by this thread at a later time with the same issue, I can not explain how this ended up happening. I even backtracked all the changed I made and it still works.
I do not even have the delays you suggested that I should insert, so that can't have been it. (it didn't fix it either, though)
Spoiler: Observations (Open)
The way I observed this random change was with this:
Spoiler: library (Open)

Code: Select all

world int 1:stufftime[];

script 98 (void) {
	print(i:stufftime[0]);
	delay(1);
	delay(stufftime[0]);
	restart;
}
Spoiler: map ACS open script (Open)

Code: Select all

stufftime[0] = 35;

The script was printing 0, constantly. Even when I had inserted this and ran it:
Spoiler: added code to map file (Open)

Code: Select all

script 76 (int rofl) {
	stufftime[0] = rofl;
}

It would still print 0 on my screen.

I then recompiled the scripts and when I booted it up it worked as supposed to. All of it.

It might be my computer borking up the compiler, I dunno. This is just here in case someone is interested in these occurences.

EDIT:
Nope, it still doesn't work, it randomly processes the values I pass to the struct array. It is definitely the culprit though.
---SUBEDIT: This edit was a huge derp on my part, I accidently used acs_execute instead of acs_executealways, which explains the "randomness" I experienced after it worked.
Last edited by Lollipop on Mon Jan 12, 2015 4:54 pm, edited 1 time in total.
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Post Reply