What would it be like if SA-MP used ... not PAWN!
#1

PAWN is a great language, easy to understand (considering you're somewhat into programming) and easy to implement. But what would it be like if SA-MP used a different kind of language? Aren't there better, higher-level or faster languages that could do the job?

Sometimes I wonder that if SA-MP required a more difficult language to learn (maybe, C#/+/++ or Java?) then PAWN there would be less horrible scripts because people who weren't "involved" in programming woulden't be bothered learning it in the first place.

That's not what this topic is about though. I'd really like to see what code would look like if SA-MP used ... For JAVA, I assume it could be something like this (and you're free to state your opinion on the language of your choice)!

SA-MP in JAVA? :
PHP Code:

public int OnPlayerConnect(Player player) {
    
Color c = new Color(255255255);
    
player.sendMessage(c"Hello there!");
    return 
1;
}
public 
int OnPlayerText(Player playerString text) {
    
int pID player.getID();
    
int pName player.getName();
    
text pName " [" pID "]: "text;
    
Color c = new Color("red");
    
server.sendMessage(ctext);
    return 
0;
}
public 
int OnPlayerCommandText(Player playerString cmdtext) {
    if(
cmdtext.equals("mycommand")) {
        
// Player typed "/mycommand"
        
return 1;
    }
    return 
0;
}
// Or maybe create a samp object somewhere?
SObject s = new SObject(1532);
s.setCoords(0.00.00.0);
s.setRotation(180.0);
s.setWorld(5);
s.setVisible(true); 
Any more ideas?
Reply
#2

Actually PAWN can get pretty advanced but you won't need it to make a up to the current standard script.

Even if there would be a more 'complicated language' people will still release these kinds of scripts, all the advanced jobs will be done behind the scenes or someone will create some kind of framework to make it easier. Besides I don't really see why you there should be a more advanced language for SAMP, PAWN is an embedded language it's perfect for what it does right now.
Reply
#3

There are wrappers for java and c# afaik, but both projects are sleeping or died.
Reply
#4

You want things to be tough?

Damn.. Pawn is gr8.
Look at lua, it's hard.
Reply
#5

Lua is easier than most scripting languages, what you talking bout?
Reply
#6

I prefer C#/C++ ...
Reply
#7

Quote:
Originally Posted by Sniper Kitty
View Post
Lua is easier than most scripting languages, what you talking bout?
I think it's harder . I like C++ and PAWN
Reply
#8

If you think LUA is harder to learn than c++, then your not learning c++ correct. c++ is well known to be one of the most complicated languages around.
Reply
#9

LUA is just weird because it doesn't use brackets. Very easy to lose sight of your script.
Reply
#10

I dislike Java, and it won't keep new scripters away. They will download java gamemodes and edit it a bit.
Reply
#11

The only thing I want is objects. SA-MP would have been a lot *cleaner if it had had that.
Reply
#12

There is really nothing that objects give that you can't do in SA:MP anyway. All objects do is encapsulate state and operations on state, exposing a function-based API for use. You can EXACTLY that with files and static global variables, and since generally objects are in separate files anyway, there's really no difference!
Reply
#13

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
There is really nothing that objects give that you can't do in SA:MP anyway. All objects do is encapsulate state and operations on state, exposing a function-based API for use. You can EXACTLY that with files and static global variables, and since generally objects are in separate files anyway, there's really no difference!
That's true. Actually, I think PAWN is as good as any other language, but I miss the OOP I got used to programming in Java and PHP.
Reply
#14

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
There are wrappers for java and c# afaik, but both projects are sleeping or died.
Actually, that's my newest project - Object-oriented PAWN wrapper (c#)
Reply
#15

Quote:
Originally Posted by Vince
View Post
LUA is just weird because it doesn't use brackets. Very easy to lose sight of your script.
You can use the opening and closing brackets (also the semi-colon too) in Lua, it's just unnecessary (optional).

Quote:
Originally Posted by king_hual
View Post
Actually, that's my newest project - Object-oriented PAWN wrapper (c#)
Can't wait!
Reply
#16

Quote:
Originally Posted by king_hual
Посмотреть сообщение
Actually, that's my newest project - Object-oriented PAWN wrapper (c#)
Yay! I find OOP much cleaner myself too!
Reply
#17

Seems that you took this ideia from bukkit.
Reply
#18

Quote:
Originally Posted by Mandrakke
Посмотреть сообщение
Seems that you took this ideia from bukkit.
There are many more Java projects than bukkit. Also, I hope that the Java would be a lot better than that in the first post, and allow chaining.
Код:
SObject s = new SObject(2102).setCoords(402.0, 52.4, 63.7).setRotation(0.0).setWorld(5).setVisible(true);

public int OnPlayerText(Player player, String text) {
   server.sendMessage(new Color("red"), player.getName() + "[" + player.getID() + "]: " + text);
   return 0;
}
Reply
#19

I guess it would be a horrible job to link the sa-mp server with a java "script". Java needs a virtual machine, that would need to be loaded by the server. Then the java script itself would need to create a connection to the server, and communication would work with something like sockets. After all you would create a "gamemode program" not a script, with lots of unneccessary stuff that you wouldnt need with a script language. Already simply using dll natives in a java program is an ugly job. Java isnt a script language, like many others too, and all of them are difficult to use for that. Thats the reason why most multiplayer games use "scripts" and not "programs". Bukkit is a real exception, as minecraft itself is written in java, so it just needs to hook the class files to the rest.
Reply
#20

Actually Mauzen, its entirely possible to have a Java server and C++ client. The data sent would still be the same. Therefore, no dlls woild be required because everything could be handled by jar libraries. Therefore, the SAMP team could provide a library containing the API (including networking) and then users could add it to the build path and use it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)