[Tutorial] Basics of scripting
#9

Quote:
Originally Posted by Y_Less
View Post
As you should know - PAWN is NOT a sub-language of C++. PAWN is a typeless imperative language, C++ is a typed object oriented language. Both PAWN (through SMALL-C/SMALL) and C++ are based on C, but they have nothing to do with each other directly. That's like saying a TV is a type of microwave because they're both based on electricity, or that gorrilas are a type of human because they're both descended from primative primates. PAWN and C++ followed very different develpoment paths from C and saying they're related is just misleading and wrong!

Also, starting a tutorial with "this is boring" is NOT a good start!

And there are [pawn] and [code] tags you can use instead of code and quote (and pawn gives syntax highlighting).

And your very first example will not run - there is no "main" function, which is more important that OnGameModeInit.

Fundamental data types <- PAWN is typeless, there is only one type, the cell. This section is entirely redundant.

Strings are not special arrays, they are just arrays. And characters are not 1 byte big, as I just said there is only one type in PAWN - the cell, so characters are one cell big (excluding packed strings, but they're rarely mentioned).

'\0' is not two characters - it is one character, the '\0' character.

PAWN has native array bounds checking - accessing an array element which doesn't exist will not crash the server it will give an error in the console.

// is not known as a line comment (at least not in any documentation I've ever seen) - "called by me" and "known as" are not the same thing - this is a "stream" comment. Block comment is accurate.

print is not an output stream - I can tell you've lifted that straight from the C++ tutorial, where streams do exist. print is an output function.

void is not a reserved word - this only has meaning in a typed language, and PAWN is typeless.

class is not a reserved word - this only has meaning in an object oriented language such as C++, which PAWN is in no way related to.

It is the "SA-MP wiki" - "wiki" is a noun, "wikipedia" is a trademark name for one wiki.

The major missing section in here is control flow - you're not going to get very far in coding without "if" or "for" etc.

-2147483648 is not poorly defined in PAWN, it is just a number, it is however not well handled by the printf function - which is part of the SA-MP API, NOT part of PAWN. PAWN defines the syntax and operators used, the SA-MP library is a set of functions within the PAWN language construct - separating these two is very important. The pawn homepage is here: http://www.compuphase.com/pawn/pawn.htm and makes no mention of SA-MP or most of the functions anywhere. That site also includes the infamous PAWN language guide: http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf - which I suggest you read thoroughly!

Some bits were good though.
Holy shit... "owned"
Reply


Messages In This Thread
Basics of scripting - by Lenny the Cup - 11.08.2010, 13:39
Re: Basics of scripting - by Kar - 11.08.2010, 13:51
Re: Basics of scripting - by Lenny the Cup - 11.08.2010, 14:14
Re: Basics of scripting - by Toni - 11.08.2010, 14:16
Re: Basics of scripting - by Kar - 11.08.2010, 14:31
Re: Basics of scripting - by Lenny the Cup - 11.08.2010, 14:32
Re: Basics of scripting - by Kar - 11.08.2010, 14:45
Re: Basics of scripting - by Mimic - 11.08.2010, 15:01
Re: Basics of scripting - by Mimic - 11.08.2010, 15:04
Re: Basics of scripting - by Lenny the Cup - 11.08.2010, 15:27
Re: Basics of scripting - by Lenny the Cup - 11.08.2010, 16:22
Re: Basics of scripting - by Lenny the Cup - 11.08.2010, 17:10
Re: Basics of scripting - by Sergei - 11.08.2010, 17:46
Re: Basics of scripting - by Kevin_Joshen - 11.08.2010, 22:15
Re: Basics of scripting - by DiddyBop - 11.08.2010, 23:04
Re: Basics of scripting - by Steven82 - 12.08.2010, 17:27
Re: Basics of scripting - by Lee_Percox - 12.08.2010, 17:44
Re: Basics of scripting - by Lenny the Cup - 12.08.2010, 18:16
Re: Basics of scripting - by Brian_Furious - 17.08.2010, 18:41
Re: Basics of scripting - by Lenny the Cup - 20.08.2010, 09:12
Re: Basics of scripting - by playbox12 - 20.08.2010, 19:40
Re: Basics of scripting - by Lenny the Cup - 21.08.2010, 15:37

Forum Jump:


Users browsing this thread: 2 Guest(s)