AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   New API and Syntax (https://forums.alliedmods.net/showthread.php?t=244092)

BAILOPAN 07-13-2014 16:46

Re: New API and Syntax
 
Quote:

Originally Posted by Arkarr (Post 2167124)
Why 'char' instend of String ?

The reason is alluded to in the post, but it's worth clarifying. In normal type systems, the concept of a "string" is a data type in and of itself. For example:

PHP Code:

string x "hello!"

In Pawn, it is:
PHP Code:

String:x[] = "hello1"

Here, "String" is really a storage modifier affecting how the array is allocated. It's not actually a string - it's just telling the array that it's an array of characters. It looks like a string, but it's a hack. Long-term we want to provide a true string type. It's important that we begin to eliminate the concept of String: ahead of time, to eliminate any confusion. char may be unfamiliar but it's much more true to what's actually going on.

I myself look forward to a point in time when we have API calls like this:
PHP Code:

native string GetClientName(int client); 


pheadxdll 07-13-2014 17:03

Re: New API and Syntax
 
1. Can you separate a class's code from it's declaration? I see all the code in the methodmap declaration.
2. Is SM 1.7 stable enough to run on a live server? :3

Arkarr 07-13-2014 17:22

Re: New API and Syntax
 
@BAILOPAN
If I have understand correctly, this is wrong :
PHP Code:

public bool PrintMessageToAll(string message)
{
     
PrintToChatAll(message);
     
PrintToConsole(message);
     return 
true;


and this is correct ?
PHP Code:

public bool PrintMessageToAll(const char[] message)
{
     
PrintToChatAll(message); //But PrintToChatAll() only accept 'pawn string' so char should work as well without formating value ?
     
PrintToConsole(message); //same as PPrintToChatAll() ?
     
return true;



VoiDeD 07-13-2014 17:25

Re: New API and Syntax
 
Quote:

Originally Posted by pheadxdll (Post 2167138)
1. Can you separate a class's code from it's declaration? I see all the code in the methodmap declaration.

Not (yet?). See https://bugs.alliedmods.net/show_bug.cgi?id=6182 for something similar.

Quote:

Originally Posted by pheadxdll (Post 2167138)
2. Is SM 1.7 stable enough to run on a live server? :3

The majority of the changes thusfar are related to the compiler. The rest of SM should run just fine on a live server, at least in the current state. I assume there will be no such promises once JIT changes come into play.

Also, you should be able to run plugins compiled in 1.7 on a 1.6 server, again: at least for now.

Powerlord 07-13-2014 22:15

Re: New API and Syntax
 
So, basically this is replacing all the SourcePawn 2.0 stuff that was happening before?

BAILOPAN 07-13-2014 23:02

Re: New API and Syntax
 
Quote:

Originally Posted by pheadxdll (Post 2167138)
1. Can you separate a class's code from it's declaration? I see all the code in the methodmap declaration.
2. Is SM 1.7 stable enough to run on a live server? :3

1. No.
2. Right now 1.7 is basically the same as 1.6 with some compiler changes. So it should be stable. I'm hoping that 1.7 will be mostly an API refactoring release.

BAILOPAN 07-13-2014 23:03

Re: New API and Syntax
 
Quote:

Originally Posted by Powerlord (Post 2167251)
So, basically this is replacing all the SourcePawn 2.0 stuff that was happening before?

I don't want to commit to anything but there's a reason the API is called "Transitional".

GsiX 07-14-2014 07:43

Re: New API and Syntax
 
Look like i have to start all over again and catch up with the rest of the new beginner.

WildCard65 07-14-2014 08:32

Re: New API and Syntax
 
Quote:

Originally Posted by BAILOPAN (Post 2167095)
All of the changes are opt-in, and old scripts will continue to compile.

I highly doubt that old scripts can compile on SM 1.7 atm...
See: https://travis-ci.org/50DKP/FF2-Official
But other then that, taking a look at method maps documentation link, they are REALLY AWESOME! Much neater then current system as it actually makes things easier to understand.

Wliu 07-14-2014 10:40

Re: New API and Syntax
 
Quote:

Originally Posted by WildCard65 (Post 2167415)
I highly doubt that old scripts can compile on SM 1.7 atm...
See: https://travis-ci.org/50DKP/FF2-Official
But other then that, taking a look at method maps documentation link, they are REALLY AWESOME! Much neater then current system as it actually makes things easier to understand.

Do note that the current compiler errors are only with morecolors.inc...which is not included with SM.
It looks to me more like a compiler bug (looking at the line numbers and error #) than "1.6 is incompatible with 1.7".


All times are GMT -4. The time now is 22:24.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.