SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 16/05/2018, 05:43 PM   #4551
Mister0
Huge Clucker
 
Mister0's Avatar
 
Join Date: Aug 2015
Posts: 215
Reputation: 19
Default Re: Little coding questions - For general minor queries 5

nevermind

Last edited by Mister0; 16/05/2018 at 06:35 PM.
Mister0 is offline   Reply With Quote
Old 18/05/2018, 06:20 PM   #4552
Dignity
High-roller
 
Join Date: May 2013
Location: Belgium
Posts: 1,862
Reputation: 1082
Default Re: Little coding questions - For general minor queries 5

I just reinstalled Sublime Text 3 and for some reason whenever I get an error, clicking it in the console output doesn't jump to the file and also doesn't highlight the error.

Is there some kind of dependency I'm missing?


EDIT: I fixed it by wiping everything, dling version 3103, re-installed pawn syntax setting it up and then upgrading back to the current version.

I have a strong feeling my build file was incorrect but who knows, it's fixed now.

Last edited by Dignity; 18/05/2018 at 11:05 PM.
Dignity is offline   Reply With Quote
Old 07/06/2018, 12:23 AM   #4553
Dignity
High-roller
 
Join Date: May 2013
Location: Belgium
Posts: 1,862
Reputation: 1082
Default Re: Little coding questions - For general minor queries 5

I've been stuck on this for a while and after many attempts, I still can't figure it out.

How exactly do I split words using sscanf from a string into an array?

The point is that the array should be dynamic depending on the amount of words. I tried storing stuff into a massive 2d array using p<|> but to no avail. (Array size 128 and size 256 - first would be the word, second would be the length)

For example...

"Curiousity killed the cat"

Gives us...

Code:
var[0] = Curiousity
var[1] = Killed
var[2] = The
var[2] = Cat

But it won't work. The code literally looks like nonsense and it doesn't work but if need be I could share what I have... I doubt I'm doing it the right way though.

Would be great if someone can figure this out.
__________________



Dignity is offline   Reply With Quote
Old 14/06/2018, 04:36 PM   #4554
ByMatt20030
Big Clucker
 
Join Date: Jul 2016
Posts: 76
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Hi to everyone!

Could anyone explain me what exactly do -d params at compile time?

Actually i only know one thing:
-With -d3 the script compiles faster...
-d3 and -d2 prints some aditional info at finishing the compilation.

But i supose there is something more than that.

Thanks for reading, have a nice day!
ByMatt20030 is offline   Reply With Quote
Old 14/06/2018, 04:56 PM   #4555
Jeroen52
Gangsta
 
Jeroen52's Avatar
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 862
Reputation: 71
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by ByMatt20030 View Post
Hi to everyone!

Could anyone explain me what exactly do -d params at compile time?

Actually i only know one thing:
-With -d3 the script compiles faster...
-d3 and -d2 prints some aditional info at finishing the compilation.

But i supose there is something more than that.

Thanks for reading, have a nice day!
These are my compile times with the compiler fixes.
Code:
$ time pawncc "-;+" "-(+" -i:../pawno/include SFCRRPG.pwn -d3 -Z -E
Pawn compiler 3.10.7	 	 	Copyright (c) 1997-2006, ITB CompuPhase

Header size:          43996 bytes
Code size:          3779540 bytes
Data size:          6761348 bytes
Stack/heap size:      16384 bytes; estimated max. usage=3019 cells (12076 bytes)
Total requirements:10601268 bytes

real	0m1.842s
user	0m1.832s
sys	0m0.008s
$ time pawncc "-;+" "-(+" -i:../pawno/include SFCRRPG.pwn -d3 -Z -E
Pawn compiler 3.10.7	 	 	Copyright (c) 1997-2006, ITB CompuPhase

Header size:          43996 bytes
Code size:          3779540 bytes
Data size:          6761348 bytes
Stack/heap size:      16384 bytes; estimated max. usage=3019 cells (12076 bytes)
Total requirements:10601268 bytes

real	0m1.870s
user	0m1.848s
sys	0m0.020s
$ time pawncc "-;+" "-(+" -i:../pawno/include SFCRRPG.pwn -d3 -Z -E
Pawn compiler 3.10.7	 	 	Copyright (c) 1997-2006, ITB CompuPhase

Header size:          43996 bytes
Code size:          3779540 bytes
Data size:          6761348 bytes
Stack/heap size:      16384 bytes; estimated max. usage=3019 cells (12076 bytes)
Total requirements:10601268 bytes

real	0m1.851s
user	0m1.820s
sys	0m0.020s
$ time pawncc "-;+" "-(+" -i:../pawno/include SFCRRPG.pwn -Z -E
Pawn compiler 3.10.7	 	 	Copyright (c) 1997-2006, ITB CompuPhase

$ time pawncc "-;+" "-(+" -i:../pawno/include SFCRRPG.pwn -Z -E

real	0m4.335s
user	0m4.300s
sys	0m0.024s
Pawn compiler 3.10.7	 	 	Copyright (c) 1997-2006, ITB CompuPhase


real	0m4.347s
user	0m4.312s
sys	0m0.028s
$ time pawncc "-;+" "-(+" -i:../pawno/include SFCRRPG.pwn -Z -E
Pawn compiler 3.10.7	 	 	Copyright (c) 1997-2006, ITB CompuPhase


real	0m4.307s
user	0m4.280s
sys	0m0.020s
The -d flags should include debug info in the p-code which should make debugging easier (and the .amx slightly larger).

The general rule of thumb that I take is that you use -d3 for debugging, and whenever you're putting the code on a live server that you're not actively debugging you take that away.
__________________
Jeroen52 is offline   Reply With Quote
Old 14/06/2018, 04:57 PM   #4556
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,885
Reputation: 1443
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by ByMatt20030 View Post
Hi to everyone!

Could anyone explain me what exactly do -d params at compile time?

Actually i only know one thing:
-With -d3 the script compiles faster...
-d3 and -d2 prints some aditional info at finishing the compilation.

But i supose there is something more than that.

Thanks for reading, have a nice day!
-d is the "debug" flag, in addition to what you already mentioned, it also adds additional information to the resulting .amx file which the crashdetect plugin uses to provide more useful crash reports. This is what makes it possible to see the exact line of code that produced a crash.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 14/06/2018, 04:57 PM   #4557
RoboN1X
Huge Clucker
 
RoboN1X's Avatar
 
Join Date: Feb 2011
Location: Indonesia
Posts: 300
Reputation: 57
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by ByMatt20030 View Post
Hi to everyone!

Could anyone explain me what exactly do -d params at compile time?

Actually i only know one thing:
-With -d3 the script compiles faster...
-d3 and -d2 prints some aditional info at finishing the compilation.

But i supose there is something more than that.

Thanks for reading, have a nice day!
It's debug levels...

If you open pawncc.exe in command prompt console you'll get all available options like this:
Code:
Pawn compiler 3.2.3664                  Copyright (c) 1997-2006, ITB CompuPhase

Usage:   pawncc <filename> [filename...] [options]

Options:
         -A<num>  alignment in bytes of the data segment and the stack
         -a       output assembler code
         -C[+/-]  compact encoding for output file (default=+)
         -c<name> codepage name or number; e.g. 1252 for Windows Latin-1
         -Dpath   active directory path
         -d<num>  debugging level (default=-d1)
             0    no symbolic information, no run-time checks
             1    run-time checks, no symbolic information
             2    full debug information and dynamic checking
             3    same as -d2, but implies -O0
         -e<name> set name of error file (quiet compile)
         -H<hwnd> window handle to send a notification message on finish
         -i<name> path for include files
         -l       create list file (preprocess only)
         -o<name> set base name of (P-code) output file
         -O<num>  optimization level (default=-O1)
             0    no optimization
             1    JIT-compatible optimizations only
             2    full optimizations
         -p<name> set name of "prefix" file
         -r[name] write cross reference report to console or to specified file
         -S<num>  stack/heap size in cells (default=4096)
         -s<num>  skip lines from the input file
         -t<num>  TAB indent size (in character positions, default=8)
         -v<num>  verbosity level; 0=quiet, 1=normal, 2=verbose (default=2)
         -w<num>  disable a specific warning by its number
         -X<num>  abstract machine size limit in bytes
         -XD<num> abstract machine data/stack size limit in bytes
         -\       use '\' for escape characters
         -^       use '^' for escape characters
         -;[+/-]  require a semicolon to end each statement (default=-)
         -([+/-]  require parantheses for function invocation (default=-)
         sym=val  define constant "sym" with value "val"
         sym=     define constant "sym" with value 0

Options may start with a dash or a slash; the options "-d0" and "/d0" are
equivalent.

Options with a value may optionally separate the value from the option letter
with a colon (":") or an equal sign ("="). That is, the options "-d0", "-d=0"
and "-d:0" are all equivalent.
EDIT: Meh, those sudden answers
__________________
Need Help? Use Search, WIKI, and FAQ
RoboN1X is offline   Reply With Quote
Old 14/06/2018, 11:41 PM   #4558
MrakBuster
Little Clucker
 
Join Date: Jan 2018
Posts: 42
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Hello everybody.

I just downloaded a perfect include for textdraw infoboxes. The thing is, that when I use it, my connect register dialog does not show. Something tells me, that this is, what is making the problems:

Code:
public OnPlayerConnect( playerid )
	return InitPlayerTextDraws( playerid );

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect InfoBox_OnPlayerConnect
forward InfoBox_OnPlayerConnect( playerid );
My register system is based in OnPlayerConnect in my gamemode, via dialogs.

How could I pair it together?
MrakBuster is offline   Reply With Quote
Old 15/06/2018, 10:33 AM   #4559
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,885
Reputation: 1443
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by MrakBuster View Post
Hello everybody.

I just downloaded a perfect include for textdraw infoboxes. The thing is, that when I use it, my connect register dialog does not show. Something tells me, that this is, what is making the problems:

Code:
public OnPlayerConnect( playerid )
	return InitPlayerTextDraws( playerid );

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect InfoBox_OnPlayerConnect
forward InfoBox_OnPlayerConnect( playerid );
My register system is based in OnPlayerConnect in my gamemode, via dialogs.

How could I pair it together?
That hook is incorrect, it doesn't continue the chain by calling the next callback. This is one of the reasons I advise against ALS because there are so many typos and mistakes that can go unnoticed which break the entire thing. y_hooks is your best bet for this.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 15/06/2018, 02:21 PM   #4560
MrakBuster
Little Clucker
 
Join Date: Jan 2018
Posts: 42
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Nice, thank you very much!

Another thing popped, you seem really experienced in this, so I will try whether you can help me with this too:

error 021: symbol already defined: "isNumeric"

This popped up on me today, after I tried to compile old FS that I had in my "spider-web storage" on USB drive. I guess it means, that isNumeric is defined twice. In the FS it is definitely only once, and I tried to search for isNumeric in the includes of that FS, but I have not found it there too.

how could i solve this? the funny part is, that when i remove that stock from the script, it compiles just fine, but i am still interested, where the error can be, in order to prevent such situations in future

thanks.
MrakBuster 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a soldier aotumaticly be general when the general dies ? AlbanianGuy Scripting Help 35 13/05/2012 03:35 PM
Minor problem Desert Help Archive 4 17/03/2010 06:24 PM
Counting with mysql queries actiwe Help Archive 2 26/02/2010 02:36 PM
SQL queries using GROUP BY Dabombber Help Archive 2 05/10/2009 07:47 PM


All times are GMT. The time now is 04:25 AM.


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