Raised This Month: $51 Target: $400
 12% 

Solved [L4D2] Masses of compiling error 010 without detectable cause?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 12-02-2019 , 07:28   [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #1

realconfusion.png

This piece of code, specifically GetCryOutNumber, spouted so much compile errors that I can't pinpoint to; the errors only happen after the first else. I've already updated to the latest sourcemod, and this still happens.

Code requires SceneProcessor, found here.

Spoiler


Code:
C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\L4D_DeadRinger.sp(757) : error 010: invalid function or declaration
// C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\L4D_DeadRinger.sp(759) : error 010: invalid function or declaration
// C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\L4D_DeadRinger.sp(760) : error 010: invalid function or declaration
// C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\L4D_DeadRinger.sp(761) : error 010: invalid function or declaration
// C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\L4D_DeadRinger.sp(762) : error 010: invalid function or declaration
// C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\L4D_DeadRinger.sp(764) : error 010: invalid function or declaration
This was only a quarter of the spammed errors from the compiler.

EDIT: After forcing and converting the plugin into new syntax, (turns out it was all just an easy fix and one guess) there's now an additional error popping up at the top of the error spam:
Code:
C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\L4D_DeadRinger.sp(760) : error 054: unmatched closing brace ("}")
Even though this looks like the cause of all this, I still don't get it. On Notepad++ the reported brace is lining up perfectly with the other brace, securing the function in. How could this happen?
Attached Files
File Type: sp Get Plugin or Get Source (L4D_DeadRinger.sp - 4 views - 51.8 KB)

Last edited by Shadowysn; 12-02-2019 at 21:24.
Shadowysn is offline
JoinedSenses
Senior Member
Join Date: Sep 2013
Old 12-02-2019 , 09:46   Re: [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #2

On mobile right now, so my help is limited.

One thing I noticed is the char functions need to be char[]. They must return a variable, not a const, meaning anything with quotes or brackets. You also cant initialize arrays with a non constant. It must first be declared, then set. Here is a working example:

Code:
#include <sourcemod>

public void OnPluginStart() {
	char w[32];
	w = f();
	PrintToServer(w);
}

char[] f() {
	char w[] = "whatever";
	return w;
}
Might be better to instead pass the string as a function parameter by ref instead of returning it. Example:
Code:
#include <sourcemod>

public void OnPluginStart() {
	char w[32]
	f(w, sizeof(w));
	PrintToServer(w);
}

void f(char[] w, int size) {
	strcopy(w, size, "whatever");
}
Sourcepawn also does not allow string comparisons with ==. Use StrEqual or do someString[0] == '\0' to check if string is empty.
__________________

Last edited by JoinedSenses; 12-02-2019 at 10:05.
JoinedSenses is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 12-02-2019 , 10:21   Re: [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #3

Quote:
Originally Posted by JoinedSenses View Post
On mobile right now, so my help is limited.

One thing I noticed is the char functions need to be char[]. They must return a variable, not a const, meaning anything with quotes or brackets. You also cant initialize arrays with a non constant. It must first be declared, then set. Here is a working example:

Code:
#include <sourcemod>

public void OnPluginStart() {
	char w[32];
	w = f();
	PrintToServer(w);
}

char[] f() {
	char w[] = "whatever";
	return w;
}
Might be better to instead pass the string as a function parameter by ref instead of returning it. Example:
Code:
#include <sourcemod>

public void OnPluginStart() {
	char w[32]
	f(w, sizeof(w));
	PrintToServer(w);
}

void f(char[] w, int size) {
	strcopy(w, size, "whatever");
}
Sourcepawn also does not allow string comparisons with ==. Use StrEqual or do someString[0] == '\0' to check if string is empty.
Thanks for those suggestions as well as reminding me not to compare strings using == (I had an obscure feeling that something was wrong when I did that)

Unfortunately the main problem still exists - the compiling is screwed over after the else part.
I don't know why, but the compiler's failing and I do not know why or how. One of the lines it reports is:
else if (StrEqual(cl_survname, "producer", false))
when there was another line before that used the EXACT same function:
if (StrEqual(cl_survname, "gambler", false))

It could be the else that is broken, but I don't know why...?

Last edited by Shadowysn; 12-02-2019 at 10:27.
Shadowysn is offline
JoinedSenses
Senior Member
Join Date: Sep 2013
Old 12-02-2019 , 10:27   Re: [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #4

Post your new code, or you also might get better feedback if you join the sourcemod discord channel. https://discord.gg/HUc67zN
__________________
JoinedSenses is offline
Marttt
Senior Member
Join Date: Jan 2019
Old 12-02-2019 , 17:24   Re: [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #5

Try this code attached


But IMO seems that this code don't work since the "SpoutDeathOfSurvivorName" method is never called. :S
Attached Files
File Type: sp Get Plugin or Get Source (L4D_DeadRinger.sp - 10 views - 53.1 KB)
__________________
Marttt is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 12-02-2019 , 21:14   Re: [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #6

Quote:
Originally Posted by Marttt View Post
Try this code attached


But IMO seems that this code don't work since the "SpoutDeathOfSurvivorName" method is never called. :S
The whole vocal method is unfinished, BeginVocalizations is supposed to call that function for the first vocal.

There was a few errors but it works now, thanks!
__________________
ragdoll spam, that is all
Shadowysn is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:38.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode