Odd issue with PAWNO.
#1

For some reason the last few builds I am getting a warning about 3 unused variables.

What's odd about that? The line numbers reference.... well my game mode script doesn't even have that many lines,
so it is impossible..... and doing a search, it cannot find them in the script either....

These are the only warnings or output from building.
Reply
#2

You maybe are doing
pawn Код:
new var;
public OnPlayerConnect
{
    var = 1;
    return 1;
}
It will say unused symbol var..
You should do something like this
pawn Код:
if(var == 1)
{
    return 1;
}
else if(var == 2)
{
    return 2;
}
Reply
#3

oh, dont worry for just 3 variables not being used.
if ANYONE suggests you to use the #pragma directive: IGNORE it please.
imagine you edit your gamemode (i assume you do that each day hehe), and you got an idea for like.. hm.. a lottery. what you do then? you add 1 variable like
Код:
new LottoJackpot;
then you get distracted, and you go on with scripting something else - the variable LottoJackpot will remain intact, unused. in your whole gamemode. thats why the line count raises up your gamemode size: its not used anywhere in all lines, so it will give you a warning about that. a simple way is to comment it out, so it wont even waste some memory:
Код:
//new LottoJackpot;
and 1 warning is gone. do that with the other variable aswell, and later, when you go on scripting the "lottery", then you will uncomment the variable declaration before you use it later in the script...
Reply
#4

Good advice Babul!, I generally don't like supressing warnings or errors of any kind.

The problem is, using PAWNO's find function, these "variables" do not actually exist, and the line numbers the output refer to are impossible (my script ends at say line 8706, there is nothing beyond it, but the warning states 3 variables at line 8707, 8708 and 8709).

Seems like some sort of bug?
Reply
#5

I see the problem now.

They were at the top around line 100......

That's not a very good warning lol.

Because I basically use variables at the beginning of gamemode like global variables for the whole thing, if I am not using them anymore it gets screwy.
Reply
#6

Probably it's an include warning.
Take a look to the compiler's report. it wouldn't refer to your script but probabily to some include.
Let me know.
-P

Код:
...\Directory\nameoffile.pwn(line)
EDIT: I see you fixed
Reply
#7

nice to see that it helped...
sad to know that you learned from a bad teacher!!! why?
coz i have to admit: i suppress all warnings 203 (symbol never used) and 204 (symbol is assigned a value that is never used) at compiling, by providing the -w203 -w204 compile options parameters, coz if i dont do that, i will get like >80 warnings.
since i rescripted my gamemode 3 times yet in 2 years, there are always things (arrays, variables, callbacks, even commands!) left from the "precessor". doing that is a stupid behavior - which evolved at times where saving 2 copies of a file was not that "cheap" and fast as it is today. i always worked with ONE file, and just compressed a backup like filename_20110924 and copied it to a floppy disc
by doing this, i got used to keep all shit in my gamemode. dont ever repeat my faults! its HARD, yet almost impossible, to get rid of keeping trash in the source! clean up your code! comment it out, or remove the unused variable lines entirely, then you will get a clean compile report ^^

btw: it will be no surprise to you when i tell you that my gamemode.pwn is 600KBytes and 18800 lines only, but its .amx size exceeds 13MBytes? it even needs a stack/heap size greater than 16 KBytes, but thats not the problem. it can be really annoying to know that you need to waste 1 whole freakin minute to copy your 13MB gamemode to the server with 120 KBytes/second only, knowing that half of 2 minutes (oh dear, thats 1 - for real hah) is just spent on copying unused array cells?
if you ever intend to outsource some scripts, like changing your lotto script into a filterscript, DO IT
you rarely want to change a working script, so why need to script around/compile/copy-to-server it each time? plus: a filterscript can be released ^^
Reply
#8

Did you ever thought that fixing those errors would (drastically) decrease the amx size?
Reply
#9

It could but if removing a couple of variables makes that much of a difference, I would be concerned about the quality of the compiler lol.

I have been thinking about what might be more appropriate to have as filterscripts to compliment the game mode, but there is a limit of 16 (I assume 16 loaded at any one time).

Although the game mode I have is one I am modifying to the point of no return (it has been a good start to familiarize myself with PAWN and SA:MP), it is terribly written lol.

The only error in PAWN I would want to turn off is the indentation one, although I do like to have it done neatly, the original author seems like 8 indentations per branch with no consistency, I normally go for 2.
Reply
#10

I would be more concerned about the quality of your scripting, rather than the compiler
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)