ACC errors

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
Lisac_the_fox
Posts: 137
Joined: Fri Oct 18, 2013 7:22 am
Location: In front of hell, looking down into the deep red abyss.

ACC errors

Post by Lisac_the_fox »

Ok, i tried to compile all out war's acs. I got error:

Code: Select all

Line 16 in file "a_functions.acs" ...
a_functions.acs:16: Invalid identifier.
> function int sqrt(
>                 ^
I using latest acc (ACC-r3889)
I post this on aow forum but none respond for 10 days.
My command line:

Code: Select all

acc aow2scrp.acs aow2.o
pause
Please help.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: ACC errors

Post by Blue Shadow »

I believe that's because the [wiki]sqrt[/wiki] function is already there as a built-in function, so you don't need to define it again.
User avatar
Lisac_the_fox
Posts: 137
Joined: Fri Oct 18, 2013 7:22 am
Location: In front of hell, looking down into the deep red abyss.

Re: ACC errors

Post by Lisac_the_fox »

I am not, its aow 2, i will try to remove it.
User avatar
Lisac_the_fox
Posts: 137
Joined: Fri Oct 18, 2013 7:22 am
Location: In front of hell, looking down into the deep red abyss.

Re: ACC errors

Post by Lisac_the_fox »

No, now got

Code: Select all

Line 547 in file "a_util.acs" ...
a_util.acs:547: Function msqr is used but not defined.
a_util.acs:548: Function msqr is used but not defined.
a_util.acs:549: Function msqr is used but not defined.
a_util.acs:550: Function msqr is used but not defined.
a_util.acs:552: Function msqr is used but not defined.
User avatar
Lisac_the_fox
Posts: 137
Joined: Fri Oct 18, 2013 7:22 am
Location: In front of hell, looking down into the deep red abyss.

Re: ACC errors

Post by Lisac_the_fox »

Ok, i got it, If someone got the same problem put this as the a_functions.acs

Code: Select all

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * All Out War 2 miscallenous script functions
 * Credit to VoltlocK for originally creating the engine
 * With modifications by Eruanna, Dusk and the Omega Team
 *
 * You may use portions of this script in your project as long as you give
 * credit where credit is due. Please don't be lame and just copy-paste any
 * of this and call it your own. Thanks!
 */

// MATH FUNCTIONS
function int abs (int n) {if (n<0) return -n; return n;}
function int msqr (int n) {return n*n;}

// [Dusk] check functions

// [Dusk] returns 1 if player has $price money, discount taken into account
// if not, prints the error message and returns 0
function int CheckCredits(int price) {
	if (IsAdmin[PlayerNumber()]) return 1;
	price = ACS_ExecuteWithResult (330, price);
	
	if(Credits[PlayerNumber()+1] < price) {
		TakeInventory("PurchaseToken",1);
		LocalAmbientSound("misc/funds",255);
		DisplayCross();
		SETFONT("BigFont");
		HudMessage(s:"You need \cQ$\cD", d:price-Credits[PlayerNumber()+1], s:"\c- more to purchase this!";
			HUDMSG_FADEOUT, 240+PlayerNumber(), CR_RED, 0.5, 0.45, 2.0, 1.0);
		
		if (GetLevelInfo (LEVELINFO_LEVELNUM) == 20 || GetLevelInfo (LEVELINFO_LEVELNUM) == 21)
			ThrustThing((VectorAngle(GetActorVelX(0), GetActorVelY(0)) >> 8) + 128, 25, 0, 0);
		return 0;
	}
	
	return 1;
}

// [Dusk] returns 1 if player has no class, 0 of they have, along with error message
function int IsResigned(void) {
	if (CheckInventory ("HasClass") == 0)
		return 1;
	
	Error ("You need to resign first!");
	
	if (GetLevelInfo (LEVELINFO_LEVELNUM) == 20 || GetLevelInfo (LEVELINFO_LEVELNUM) == 21)
		ThrustThing((VectorAngle(GetActorVelX(0), GetActorVelY(0)) >> 8) + 128, 25, 0, 0);
	
	return 0;
}

// [Dusk] returns 1 if player is pressing this button the second time
function int IsSecondPress(str StatCard, int price) {
	// AOW20 skips this check for classes
	if ((GetLevelInfo (LEVELINFO_LEVELNUM) == 20 || GetLevelInfo (LEVELINFO_LEVELNUM) == 21) && (
		StatCard != "WEAP01" && StatCard != "WEAP02" &&
		StatCard != "WEAP03" && StatCard != "WEAP04" &&
		StatCard != "WEAP05" && StatCard != "WEAP06")) {return 1;}
	
	if (!CheckInventory("PurchaseToken")) {
		ACS_ExecuteWithResult (330, price);
		SetFont(StatCard);
		HudMessage(s:"a";
			HUDMSG_FADEOUT, 2100+PlayerNumber(), CR_Green, 0.25, 0.25, 3.0, 2.0);
		ACS_ExecuteAlways (956, 0);
		return 0;
	} else {
		// [Dusk] clear the card out once the class is purchased
		HudMessage(s:""; HUDMSG_PLAIN, 2100+PlayerNumber(), CR_UNTRANSLATED, 0.0, 0.0, 0.01);
	}
	return 1;
}

// this bit is in its own script because custom functions cannot use latent functions
script 956 (void) {
	GiveInventory("PurchaseToken",1);
	Delay(35*1);
	TakeInventory("PurchaseToken",1);
	terminate;
}

// [Dusk] tick display function
function void DisplayTick (void) {
	LocalAmbientSound ("c4/use", 255);
	// SETFONT("TICK");
	// HudMessage(s:"a"; HUDMSG_FADEOUT, 2100+PlayerNumber(), CR_DarkRed, 0.5, 0.5, 2.0, 1.0);
}

function void DisplayCross (void) {
	LocalAmbientSound ("misc/nope", 127);
	// SETFONT("NOENTRY");
	// HudMessage(s:"a"; HUDMSG_FADEOUT, 2100+PlayerNumber(), CR_DarkRed, 0.5, 0.5, 2.0, 1.0);
}

// [Dusk] Barracks check
function int CheckBarracks (int Team) {
	if (IsAdmin[PlayerNumber()]) return 1;
	if (!GotBarracks[Team]) {
		Error ("Your \cFbarracks\c- has been destroyed!");
		return 0;
	}
	return 1;
}

// [Dusk] Research Centre check
function int CheckPlant (int Team) {
	if (IsAdmin[PlayerNumber()]) return 1;
	if (!GotPlant[Team]) {
		Error ("Your \cFresearch centre\c- has been destroyed!");
		return 0;
	}
	return 1;
}

// [Dusk] Refinery check
function int CheckRefinery (int Team) {
	if (IsAdmin[PlayerNumber()]) return 1;
	if (!GotRefinery[Team]) {
		Error ("Your \cFrefinery\c- has been destroyed!");
		return 0;
	}
	return 1;
}

// [Dusk] War Factory check
function int CheckFactory (int Team) {
	if (IsAdmin[PlayerNumber()]) return 1;
	if (!GotFactory[Team]) {
		Error ("Your \cFwar factory\c- has been destroyed!");
		return 0;
	}
	return 1;
}

// [Dusk] Check for free hangers
function int CheckFreeHanger (int Team) {
	if (GettingMech[Team]) {
		Error ("There is another mech in the hanger!");
		return 0;
	}
	return 1;
}

// [Dusk] Check for advanced mech research
function int CheckAdvMechResearch (int Team) {
	if (IsAdmin[PlayerNumber()]) return 1;
	if (!AdvancedMechResearch[Team]) {
		Error ("You need to research \cfadvanced mechs\c- first!");
		return 0;
	}
	return 1;
}

// [Dusk] Check for plasma cooldown
function int CheckPlasmaCooldown (void) {
	int wait;
	if (IsAdmin[PlayerNumber()]) return 1;
	if (PlasmaCooldown[PlayerNumber()] > Timer()) {
		wait = (PlasmaCooldown[PlayerNumber()] - Timer()) / 35;
		DisplayCross();
		SETFONT("BigFont");
		HudMessage(s:"You must wait \cF", d:wait, s:" seconds\c- before\n",
			s:"purchasing another \cNplasma cannon!";
			HUDMSG_FADEOUT, 240+PlayerNumber(), CR_RED, 0.5, 0.45, 2.0, 1.0);
		return 0;
	}
	return 1;
}

function void GiveInventoryBold (str what, int amount) {
	for (int i = 3800; i < 3800+PlayerCount(); i++) {
		GiveActorInventory (i, what, amount);
	}
}

// [Dusk] not really a function but I don't know where else to categorize this o_O
script 356 (void)
{
	if(PlayerTeam() == TEAM_RED)
		SetResultValue(1);
	else if(PlayerTeam() == TEAM_BLUE)
		SetResultValue(0);
}

script 336 (int Invert) {
	if (Invert == 0)
	{
		if(PlayerTeam() == TEAM_RED)
			SetResultValue(0);
		else if(PlayerTeam() == TEAM_BLUE)
			SetResultValue(1);
	}
	else
	{
		if(PlayerTeam() == TEAM_RED)
			SetResultValue(1);
		else if(PlayerTeam() == TEAM_BLUE)
			SetResultValue(0);
	}
}

function bool MitigateDoublePress(void)
{
	if ( Timer() - LastMenu[PlayerNumber()+1] < 5 )
		return true; // [SP] This is to fix the "double cost" bug
	LastMenu[PlayerNumber()+1] = Timer();
	return false;
}

function int SurrenderCount (int team) {
	int count = 0;
	for (int i = 0; i <= 31; i++) {
		if (PlayerInGame(i) && GetPlayerInfo (i, PLAYERINFO_TEAM) == team && Surrender[i]) count++;
	}
	return count;
}

// freezes all players
function void FreezeBold (void) {
	for (int i = 0; i <= 31; i++) {
		if (PlayerInGame(i) && !IsAdmin[i]) {
			SetPlayerProperty (i, PROP_TOTALLYFROZEN, true);
			SetActorProperty (3800+i, APROP_Invulnerable, true);
		}
	}
}

// reverse action for above
function void DefrostBold (void) {
	for (int i = 0; i <= 31; i++) {
		if (PlayerInGame(i) && !IsAdmin[i]) {
			SetPlayerProperty (i, PROP_TOTALLYFROZEN, false);
			SetActorProperty (3800+i, APROP_Invulnerable, false);
		}
	}
}

// refreshes time cop limit
function void RecountTimeCops (void) {
	NumTimeCops[0] = 0; NumTimeCops[1] = 0;
	for (int i = 0; i <= 31; i++) {
		if (!PlayerInGame(i)) continue;
		if (CheckActorInventory(3800+i, "TimeGun")) {
			if (GetPlayerInfo (i, PLAYERINFO_TEAM) == TEAM_RED)
				NumTimeCops[0]++;
			else if (GetPlayerInfo (i, PLAYERINFO_TEAM) == TEAM_BLUE)
				NumTimeCops[1]++;
		}
	}
}

// refreshes plasma limit
function void RecountPlasma (void) {
	NumPlasmaCannons[0] = 0; NumPlasmaCannons[1] = 0;
	for (int i = 0; i <= 31; i++) {
		if (!PlayerInGame(i)) continue;
		if (CheckActorInventory(3800+i, "PlasmaCannon")) {
			if (GetPlayerInfo (i, PLAYERINFO_TEAM) == TEAM_RED)
				NumPlasmaCannons[0]++;
			else if (GetPlayerInfo (i, PLAYERINFO_TEAM) == TEAM_BLUE)
				NumPlasmaCannons[1]++;
		}
	}
}

// checks tickets and ends the game if tickets are out
// activator is assumed to be the killer!
function void TakeTickets (int team, int count) {
	if (!SuddenDeath && !TicketPool) return;
	
	Tickets[team] -= count;
	
	// inform clients of the new ticket values by changing the counters'
	// speed. clients use these speeds to display ticket values.
	if (GetActorSpeed (TID_TICKETCOUNTER_RED) != Tickets[TEAM_RED])
		SetActorSpeed (TID_TICKETCOUNTER_RED, Tickets[TEAM_RED]);
	if (GetActorSpeed (TID_TICKETCOUNTER_BLUE) != Tickets[TEAM_BLUE])
		SetActorSpeed (TID_TICKETCOUNTER_BLUE, Tickets[TEAM_BLUE]);
	
	// tell clients to update the hud
	ACS_ExecuteAlways (931, 0);
	
	// handle ticket loss
	int d;
	if (Tickets[TEAM_BLUE] <= 0) {
		d = BlueScore () - RedScore ();
		if (d < 0) d = 0;
		
		SetFont("BIGFONT");
		HudMessageBold (s:"\cHBlue Team\cJ loses out of ticket loss";
			HUDMSG_FADEOUT, 0, CR_YELLOW, 0.5, 0.3, 2.0, 1.0);
		Log(s:"Blue loses out of ticket loss");
		
		GameOver = true;
		ConsoleCommand ("pointlimit 1");
		Team_GivePoints (TEAM_RED, d+50, 0);
	} else if (Tickets[TEAM_RED] <= 0) {
		d = RedScore () - BlueScore ();
		if (d < 0) d = 0;
		
		SetFont("BIGFONT");
		HudMessageBold (s:"\cGRed Team\cJ loses out of ticket loss";
			HUDMSG_FADEOUT, 0, CR_YELLOW, 0.5, 0.3, 2.0, 1.0);
		Log(s:"Red loses out of ticket loss");
		
		GameOver = true;
		ConsoleCommand ("pointlimit 1");
		Team_GivePoints (TEAM_BLUE, d+50, 0);
	}
}

// returns color code
function str FractionColor (int perc, int max) {
	if (perc == max)
		return "\cQ";
	else if ((perc*4)/3 >= max) // 75%
		return "\cD";
	else if (perc*2 >= max) // 50%
		return "\cF";
	else if (perc*4 >= max) // 25%
		return "\cI";
	else if (perc > 0) // 24-1%
		return "\cR";
	return "\cM"; // 0%
}

// shortcuts
function void SetFragGrenades (int grenades) {
	if (!CheckInventory ("FragGrenade"))
		GiveInventory ("FragGrenade", 1);
	SetAmmoCapacity ("FragGrenadeAmmo", grenades);
	if (CheckInventory ("FragGrenadeAmmo") < grenades) {
		GiveInventory ("FragGrenadeAmmo", grenades);
	} else if (CheckInventory ("FragGrenadeAmmo") > grenades) {
		TakeInventory ("FragGrenadeAmmo", 10);
		GiveInventory ("FragGrenadeAmmo", grenades);
	}
}

function int GetHealth (void) {return GetActorProperty (0, APROP_HEALTH);}
function void SetHealth (int hp) {SetActorProperty (0, APROP_HEALTH, hp);}
function int GetActorHealth (int tid) {return GetActorProperty (tid, APROP_HEALTH);}
function void SetActorHealth (int tid, int hp) {SetActorProperty (tid, APROP_HEALTH, hp);}
function int GetSpawnHealth (void) {return GetActorProperty (0, APROP_SPAWNHEALTH);}
function void SetSpawnHealth (int shp) {SetActorProperty (0, APROP_SPAWNHEALTH, shp);}
function int GetActorSpawnHealth (int tid) {return GetActorProperty (tid, APROP_SPAWNHEALTH);}
function void SetActorSpawnHealth (int tid, int shp) {SetActorProperty (tid, APROP_SPAWNHEALTH, shp);}
function int GetSpeed (void) {return GetActorProperty (0, APROP_SPEED);}
function void SetSpeed (int value) {SetActorProperty (0, APROP_SPEED, value);}
function int GetActorSpeed (int tid) {return GetActorProperty (tid, APROP_SPEED);}
function void SetActorSpeed (int tid, int value) {SetActorProperty (tid, APROP_SPEED, value);}
function int LevelNumber (void) {return GetLevelInfo (LEVELINFO_LEVELNUM);}
function void GivePoints (int p) {Team_GivePoints (PlayerTeam(), p, false);}

// returns the `display name` of the player with id pn
// NOTE: this function must cater for client-side acs!
function str DisplayName (int pn) {
	int tid = 3800+pn;
	if (pn < 0 || pn > 31) tid = ActivatorTID();
	
	if (CheckActorInventory (tid, "IsMech")) {
		if (CheckActorInventory (tid, "OrcaWeapons")) return"\cCOrca";
		if (CheckActorInventory (tid, "RavenWeapons")) return"\cCRaven";
		if (CheckActorInventory (tid, "WolverineWeapons")) return"\cCWolverine";
		if (CheckActorInventory (tid, "MadCatWeapons")) return"\cCMadCat";
		if (CheckActorInventory (tid, "TitanWeapons")) return"\cCTitan";
		if (CheckActorInventory (tid, "GuardianWeapons")) return"\cCGuardian";
	} else if (CheckActorInventory (tid, "PowerBerserk")) {
		return "\cGBerserker";
	} else if (CheckActorInventory (tid, "IsAdmin")) {
		return "\cJAdministrator";
	}
	
	switch (CheckActorInventory (tid, "ClassID")) {
		case CLASS_NONE: return "No class";
		case CLASS_GUNMAN: return "Gunman";
		case CLASS_ENGINEER: return "Engineer";
		case CLASS_MINIGUNNER: return "Minigunner";
		case CLASS_TECHNICIAN: return "Technician";
		case CLASS_FLAMER: return "Flamethrower";
		case CLASS_RIFLEMAN: return "Rifleman";
		case CLASS_MACHINEGUNNER: return "Machinegunner";
		case CLASS_GRENADIER: return "Grenadier";
		case CLASS_ROCKETEER: return "Rocket soldier";
		case CLASS_STEALTH: return "Stealth trooper";
		case CLASS_GAUSSGUNNER: return "Gauss gunner";
		case CLASS_CHEMWARRIOR: return "Chem warrior";
		case CLASS_SHOCKTROOPER: return "Shock trooper";
		case CLASS_COMMANDO: return "Commando";
		case CLASS_SHOTGUNNER: return "Shotgunner";
		case CLASS_SUICIDEBOMBER: return "Suicide bomber";
		case CLASS_SNIPER: return "Sniper";
		case CLASS_UTILITYGUY: return "Utility guy";
		case CLASS_DEMOEXPERT: return "Demo expert";
		case CLASS_MEDIC: return "Field Medic";
		case CLASS_LASERCHAINGUNNER: return "Laser chaingunner";
		case CLASS_JUMPJET: return "Jumpjet infantry";
		case CLASS_TIBRIFLE: return "Tiberium autorifleman";
		case CLASS_DOUBLESHOTGUNNER: return "Double shotgunner";
		case CLASS_PLASMAGUNNER: return "Plasma gunner";
		case CLASS_ARTILLERY: return "Artillery soldier";
		case CLASS_TIMECOP: return "Time cop";
		case CLASS_HARVESTER: return "Tiberium harvester";
		case CLASS_ADVHARVESTER: return "Adv. Tiberium harvester";
	}
	
	return "missingno.";
}

function int SetInventory (str item, int count) {
	int n = count - CheckInventory (item);
	if (n > 0)
		GiveInventory (item, n);
	else if (n < 0)
		TakeInventory (item, -n);
	
	return n;
}

function int SetActorInventory (int tid, str item, int count) {
	int n = count - CheckActorInventory (tid, item);
	if (n > 0)
		GiveActorInventory (tid, item, n);
	else if (n < 0)
		TakeActorInventory (tid, item, -1*n);
	
	return n;
}

// [Dusk] counts how many guardians you have
function int GuardianCount (void) {
	int n;
	for (int i = 0; i <= 31; i++) {
		if (GetPlayerInfo (i, PLAYERINFO_TEAM) == PlayerTeam() &&
		CheckActorInventory (3800+i, "PowerGuardian"))
			n++;
	}
	return n;
}

function void Error (str text) {
	LocalAmbientSound ("misc/nope", 127);
	SetFont ("BIGFONT");
	HudMessage (s:text; HUDMSG_FADEOUT, 240+PlayerNumber(), CR_DarkRed, 0.5, 0.45, 2.0, 1.0);
}

function void ReddenSector (int tag) {Sector_SetColor (tag, 255, 150, 150);}
User avatar
Kappes Buur
 
 
Posts: 4197
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: ACC errors

Post by Kappes Buur »

Lisac_the_fox wrote: I using latest acc (ACC-r3889)
ACC r3889 Oct 28 2012

ACC 1.54 Jun 09 2013
User avatar
Lisac_the_fox
Posts: 137
Joined: Fri Oct 18, 2013 7:22 am
Location: In front of hell, looking down into the deep red abyss.

Re: ACC errors

Post by Lisac_the_fox »

I got this from drd team
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: ACC errors

Post by The Zombie Killer »

Download this and run the updater. That way you'll always have the latest version.
User avatar
Enjay
 
 
Posts: 27200
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: ACC errors

Post by Enjay »

The DRD builds of ACC have never been as actively maintained as the main game files (for example, my ACC exes tended to be a bit flakey because of how I compiled them). Also, sometimes the configuration/ACS files get updated but the main code doesn't so there is no need to build a new exe.

I haven't tried it myself* but it looks as if The Zombie Killer's link will do exactly what you want/need.

[edit]* I have now and it did the job very nicely. Thanks TZK. [/edit]
Locked

Return to “Editing (Archive)”