SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/05/2012, 01:00 PM   #1
StyleR
Little Clucker
 
Join Date: Jul 2010
Posts: 49
Reputation: 0
Default Help me please

Hi,Is there anyway that I can find where i forgot to put a } because i worked like 1 mounth on a script and I forgot somewhere a } and it god like 90k lines and its imposible to find it,please i really need your help.
StyleR is offline   Reply With Quote
Old 23/05/2012, 01:07 PM   #2
miokie
High-roller
 
miokie's Avatar
 
Join Date: Jan 2007
Location: Bedfordshire, England
Posts: 1,148
Reputation: 13
Default Re: Help me please

Just back track what parts you worked on until you find the bit where you forgot to close the bracket.
__________________
miokie is offline   Reply With Quote
Old 23/05/2012, 01:10 PM   #3
jessejanssen
Huge Clucker
 
Join Date: Apr 2008
Posts: 222
Reputation: 698
Default Re: Help me please

Indeed, I have it too at the moment ( My script has a size of 63+K lines ), but you just have to track back where it's comming from because there is no other way to find/solve it.

Best regards,
Jesse
__________________
R.I.P. all people who passed away on the MH17
jessejanssen is offline   Reply With Quote
Old 23/05/2012, 01:10 PM   #4
zbt
Gangsta
 
zbt's Avatar
 
Join Date: Feb 2012
Posts: 752
Reputation: 76
Default Re: Help me please

Use Notepad++ to find the key
zbt is offline   Reply With Quote
Old 23/05/2012, 01:12 PM   #5
StyleR
Little Clucker
 
Join Date: Jul 2010
Posts: 49
Reputation: 0
Default Re: Help me please

Quote:
Originally Posted by zbt View Post
Use Notepad++ to find the key
what you mean ?
StyleR is offline   Reply With Quote
Old 23/05/2012, 01:48 PM   #6
Jonny5
Gangsta
 
Join Date: Mar 2012
Location: Mi, USA
Posts: 929
Reputation: 158
Default Re: Help me please

when you click a opening bracket in notepad++ it turns red along with its closing bracket

this might make it a little easier.
__________________
If your topic says "REP+", I ignore it.
Jonny5 is offline   Reply With Quote
Old 23/05/2012, 01:50 PM   #7
Mandrakke
Huge Clucker
 
Mandrakke's Avatar
 
Join Date: Apr 2010
Location: Brasília, Brazil
Posts: 229
Reputation: 112
Default Re: Help me please

Ok, I think that I made the solution in Javascript.

here we go;

upload your script in www.pastebin.com (do not forget to select UNLISTED and "expire in 10 minutes" in the options), after that, in the code's pastebin page, execute this script;

Code:
$ = document.getElementsByTagName("textarea")[0].innerHTML.match(/(stock|public) .*?\([\s\S]*?\n}/gim);
o = "";
for(x in $) {
    u = $[x].match(/(stock|public) (.*?)\([\s\S]*?\n}/im);
    c1 = u[0].match(/\{/g).length;
    c2 = u[0].match(/\}/g).length;
    
    if(c1 !== c2)
        o += u[2] + "\n";
}

alert("There are '}' missing in the following functions:\n\n" + o);
To execute it in the browser just type ctrl + shift + K and paste the code on the command line (if you are using firefox).



I've tested it on this page:
http://pastebin.com/tjyPBqpL


and the code works fine, but you will have issues if you have two consecutives commands with a "}" missing, so after fix a bracket missing, execute the code again and again until it gets no errors.

also this code checks only for stock's and public's commands, I can change it to work with zCMDs and stuff.
__________________
Just a random guy
Mandrakke is offline   Reply With Quote
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



All times are GMT. The time now is 02:43 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.