SA-MP Forums Archive
[Help] Brackets - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Brackets (/showthread.php?tid=297542)



[Help] Brackets - PHudson - 16.11.2011

Good afternoon SA-MP Forum:

After 2 days trying to fix it myself, I decided to ask you for help, because I'm gonna loose this gamemode if I can't fix this error.

When I try to compile my script, Pawn Compiler Library stops working. I'm sure this is caused by brackets. Missing brackets finder 1.1.0 GUI gets this result:

Quote:

MISSING BRACKET: The } bracket on line 52338 does not have a pair!
Result:
Opening angle brackets ({): 11867
Closing angle brackets (}): 11868
1 angle brackets without pair! Fix it!

But line 52338 is this one:

pawn Код:
for(new h = 0; h < sizeof(HouseInfo); h++)
                {
                    if(PlayerToPoint(2.0, i, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
                    {
                        if(HouseInfo[h][hOwned] == 1)
                        {
                            if(HouseInfo[h][hRentabil] == 0)
                            {
                /* This is line 52338*/    format(string, sizeof(string), "~r~~h~Propiedad Privada~n~~y~%s",HouseInfo[h][hOwner]); // THIS IS LINE 52338
                            }
                            else
                            {
                            format(string, sizeof(string), "~r~~h~Propiedad Privada~n~~y~---------------~r~Renta: ~w~%d~g~$~n~~r~Dueсo: ~w~%s~n~~y~---------------~n~~b~~h~/rcuarto",HouseInfo[h][hRent],HouseInfo[h][hOwner]);
                            }
                            GameTextForPlayer(i, string, 5000, 3);
                            TextDrawShowForPlayer(i, HouseDraw[i]);
                            TextDrawSetString(HouseDraw[i], string);
                            return 1;
                        }
                        else
                        {
Anyway, I think this application isn't too reliable, so I installed Notepad++. I checked brackets in that area with that compiler and I also ignored that script using /* & */, but the error persists.

I have already checked the last script I did before the error, and it's perfect. I also tried to ignore it with /* & */, but the situation is exactly the same. Obviously, I'm not going to check all the gamemode (50k lines).

Is there any way to find missing brackets with Notepad++ or other program (not Missing Brackets Finder 1.1.0)?

Thanks a lot!
PHudson


Re: [Help] Brackets - CSSI - 16.11.2011

You have Opened Brackets but Not Closed Them.
pawn Код:
else {



Re: [Help] Brackets - Kostas' - 16.11.2011

pawn Код:
for(new h = 0; h < sizeof(HouseInfo); h++)
{
    if(PlayerToPoint(2.0, i, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
    {
        if(HouseInfo[h][hOwned] == 1)
        {
            if(HouseInfo[h][hRentabil] == 0)
            {
                /* This is line 52338*/    format(string, sizeof(string), "~r~~h~Propiedad Privada~n~~y~%s",HouseInfo[h][hOwner]); // THIS IS LINE 52338
            }
            else
            {
                format(string, sizeof(string), "~r~~h~Propiedad Privada~n~~y~---------------~r~Renta: ~w~%d~g~$~n~~r~Dueсo: ~w~%s~n~~y~---------------~n~~b~~h~/rcuarto",HouseInfo[h][hRent],HouseInfo[h][hOwner]);
            }
            GameTextForPlayer(i, string, 5000, 3);
            TextDrawShowForPlayer(i, HouseDraw[i]);
            TextDrawSetString(HouseDraw[i], string);
            return 1;
        }
        else
        {
            // Code
        }
    }
}



Re: [Help] Brackets - PHudson - 16.11.2011

Quote:
Originally Posted by CSSI
Посмотреть сообщение
You have Opened Brackets but Not Closed Them.
pawn Код:
else {
I already knew that. Thank you anyway.

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
pawn Код:
for(new h = 0; h < sizeof(HouseInfo); h++)
{
    if(PlayerToPoint(2.0, i, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
    {
        if(HouseInfo[h][hOwned] == 1)
        {
            if(HouseInfo[h][hRentabil] == 0)
            {
                /* This is line 52338*/    format(string, sizeof(string), "~r~~h~Propiedad Privada~n~~y~%s",HouseInfo[h][hOwner]); // THIS IS LINE 52338
            }
            else
            {
                format(string, sizeof(string), "~r~~h~Propiedad Privada~n~~y~---------------~r~Renta: ~w~%d~g~$~n~~r~Dueсo: ~w~%s~n~~y~---------------~n~~b~~h~/rcuarto",HouseInfo[h][hRent],HouseInfo[h][hOwner]);
            }
            GameTextForPlayer(i, string, 5000, 3);
            TextDrawShowForPlayer(i, HouseDraw[i]);
            TextDrawSetString(HouseDraw[i], string);
            return 1;
        }
        else
        {
            // Code
        }
    }
}
No. The problem isn't in that callback. I have ignored it and the compilation fails. I have also attempted to modifying whatever you wrote, but that doesn't solve the problem.

Basically, I'm asking for an utility to find missing brackets, because now I'm sure I'm not going to find it in 50.000 lines. I have already tested Missing Bracket Finder 1.1.0 GUI and I doesn't work properly.
Also a plugin for Notepad++ would be useful for me.

Thanks.


Re: [Help] Brackets - MP2 - 16.11.2011

Post the entire code (the callback or wherever the code is).


Re: [Help] Brackets - PHudson - 16.11.2011

I think the problem isn't in that callback. As I said before, ignoring it doesn't make me able to compile and I don't remember to have edited anything in that part of the script.

Anyway, this is the whole callback. I don't think it is useful for solving the problem, but I feel you have more experience in PAWN than me. The first line (public) is on line 52290.

http://pastebin.com/GjJidqcP

Thanks for answering.


Re: [Help] Brackets - PHudson - 16.11.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
You need to indent your code properly - the fastest way is using "TidyPawn" (or "PawnTidy", I forget which). This will align all your braces, but at some point you will find that a function is not left aligned because it appears to be part of the previous function. The previous function is where your issue is - it is not closed correctly.
I think the code is too long to be indented in this page. I got this in the output:

Quote:

asdas


sad
as
d
as



asdasd
a
d
sad
as
d
as

Weird, isn't it?
Oh God, I feel I'm gonna loose all my progress in this gamemode.

Thanks, ******.


Re: [Help] Brackets - MP2 - 16.11.2011

Comment out all callbacks, then compile. If it works, your missing brace is in one of those callbacks. You can then un-comment one callback at a time.

Use

/*
callback stuff here
*/

to comment out the callbacks.


Re: [Help] Brackets - Chrillzen - 16.11.2011

Quote:
Originally Posted by PHudson
Посмотреть сообщение
I think the code is too long to be indented in this page. I got this in the output:



Weird, isn't it?
Oh God, I feel I'm gonna loose all my progress in this gamemode.

Thanks, ******.
Works for me, what internet browser do you use? Try ****** chrome or mozilla.


Re: [Help] Brackets - Kostas' - 16.11.2011

I don't think so. When I paste 20k lines on the dracoblue.net
I get the same results as PHudson and I use ****** Chrome