SA-MP Forums Archive
[In Development]Programming Windows with PAWN! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: [In Development]Programming Windows with PAWN! (/showthread.php?tid=286543)

Pages: 1 2


[In Development]Programming Windows with PAWN! - Sasino97 - 29.09.2011

Discontinued.

Introduction

Hi Readers

I'm currently working on a C project, that will work with PAWN scripts (4.0 compiler):
It work similar to Java(The .jar file runs in Java Abstract Machine), because this program is using the PAWN Abstract Machine, like SA-MP, and I'm implementing a lot of functions from the start.
I decided to make this program for PAWN scripters that don't know any other language.

I'm using some of the default libraries files made by CompuPhase, but I edited the names of the functions (Now they're more stylish XD):

String.inc - This library provides functions for string handling
Core.inc - This one has the basic core functions
Float.inc - This one has functions for managing floating point values
Fixed.inc - This one is not included in SA-MP, It's util for fixed point values

And finally my own include file!! It has the basic functions for managing an entire program.

Windows.inc - Made entirely by me, Sasino97

And now a little example to show you just 1/5 of what you can do now with this. (The example has changed a bit before the last example)

Example
(New syntax)

pawn Code:
/**
        InputTest - By [GF]Sasino97.
        This example will get keyboard and mouse input from the user and send it back as a messagebox.
       
        This file is provided as is (no warranties).
*/


#include <ppp> // PAWN++ - Read below
#include <windows> // Windows
#include <string> // It's the same of SA-MP, but the names are edited :D

// Notice that the "Int:", "Point:", "Color:" and "Char:" Tags ARE OPTIONAL.

Int: @WinMain() /*   The int tag is optional, same as "@WinMain()"  */
{
    SetWindowText("This is an input test!");
    MaximizeWindow();
    return 0;
}

Int: @WinExit() { Quit(); }

Int: @OnClick(Int: button, Point: x, Point: y) // "button" is the mouse button (Left, right, middle), not a button control, see windows.inc
{
    CHAR s{256}; // Same of "new s{256};", it will give no errors
    String.Format(s, 256, true, "Button: %d\nX: %d\nY: %d", button, x, y); // Same of "format" (But only in SA-MP, here it'll give errors unless you define it)
    MessageBox(s, "OnClick", ICON_WARNING, DIALOG_OK);
    return 0;
}

Int: @OnKeyPress(Int: key) // When a key is pressed
{
    CHAR s{256};
    String.Format(s, 256, true, "Key: %d", key);
    MessageBox(s, "OnKeyPress", ICON_WARNING, DIALOG_OK);
    return 0;
}
Windows PAWN 1.0 RC - Release

Notice: The examples are compiled in amx format, but with the extension ".pwnexe".
A lot of people requested it, so I will release it now (With the source code

http://www.2shared.com/file/6KUj2-BT/WinPawn.html

Set-up

This doens't have an auto-extract installer, so you have to set it up manually:

1 - Create a folder called "WinPawn" into your "Program Files" or "Program Files (x86)" directory.
2 - Put "WinPawn.exe" and the "compiler" folder into WinPawn
3 - Open your PAWN Code Editor (I suggest to use Notepad++ instead of pawno, because you can link multiple compilers), and give the right directory to the compiler, or if using pawno, put pawno in the directory of WinPawn.
4 - Include "ppp" and "windows", make your program, compile. If you are using Notepad++, please compile to ".pwnexe".
5 - Right click on the .amx/.pwnexe file, select "Open with" and browse for my program in the WinPawn directory.
6 - In the description box, write "Executable PAWN File".
7 - Press OK, and see how it works
8 - If something went wrong read again all.
9 - Good work with your programs

PAWN++

Pawn++ is not a big thing, it's just a file with some defines that you will find useful:
I called it with that name because introduces a new way to add variables: The keyword "new" disappears, and
to declare a variable, it will use

pawn Code:
#define CELL   new
    #define CHAR   new Char:
    #define BOOL   new bool:
    #define INT    new Int:
    #define POINT  new Point:
    #define COLOR  new Color:
    #define MENU   new Menu:
    #define EDIT   new Edit:
    #define RADIO  new Radio:
    #define FLOAT  new Float:
    #define FIXED  new Fixed:



Re: [In-Dev App]WinPAWN - Win32 API to PAWN! (It's not working with SA-MP) - Kyosaur - 29.09.2011

I think this is a neat project. I've messed with the SDK before, but i've never actually implemented it (partly because i have nothing that needs a scripting language). With that being said i dont see this being a really useful tool for anyone who is actually interested in software. There is a LOT to cover if you're planning to completely wrap the Win32 API- and even if you successfully do, there's gonna be a serious speed decline. Anyone who is serious about C++ or software in general would be better off learning the Win32 API or Qt (which imo is the better choice- OO by nature, no tacky naming convention, completely multi-platform, and generally a smarter setup).

Like i said though, i think the idea of embedding PAWN is a nice project idea though (especially if your interested in game development).

I think you should wait a little bit longer before releasing this; Its just a small shell atm.


Re: [In-Dev App]WinPAWN - Win32 API to PAWN! (It's not working with SA-MP) - suhrab_mujeeb - 29.09.2011

Nice but I wouldn't recommend you to release it now. Release it after some more work and new ideas and bug fixes. Nice work again.


Re: [In-Dev App]WinPAWN - Win32 API to PAWN! (It's not working with SA-MP) - Gamer_Z - 29.09.2011

Well yeah nice one but you should make also something for it,
yes this is very good for learning but erm... try to make something that is hmm, something like software people want and it is with pawn,
there is even already a web-server which uses pawn scripts to generate wbesites
something like this would be cool eg.. hmm..

..

(2 minutes later)...
Something to control the windows with pawn? Like background, settings etc :P


Re: [In-Dev App]WinPAWN - Win32 API to PAWN! (It's not working with SA-MP) - Lorenc_ - 29.09.2011

You should make a playerid parameter in IsKeyDown, would be heck useful.

EDIT: Misread the thread


Awesome job though, I'll use it fo' sure.


Re: [In-Dev App]WinPAWN - Win32 API to PAWN! (It's not working with SA-MP) - Sasino97 - 30.09.2011

Quote:
Originally Posted by Kyosaur
View Post
I think this is a neat project. I've messed with the SDK before, but i've never actually implemented it (partly because i have nothing that needs a scripting language). With that being said i dont see this being a really useful tool for anyone who is actually interested in software. There is a LOT to cover if you're planning to completely wrap the Win32 API- and even if you successfully do, there's gonna be a serious speed decline. Anyone who is serious about C++ or software in general would be better off learning the Win32 API or Qt (which imo is the better choice- OO by nature, no tacky naming convention, completely multi-platform, and generally a smarter setup).

Like i said though, i think the idea of embedding PAWN is a nice project idea though (especially if your interested in game development).

I think you should wait a little bit longer before releasing this; Its just a small shell atm.
I don't mean to wrap the entire API LoL.
I want to wrap the most useful functions, because PAWN is 10 times easier than any other Hi-Level programming language. I'm planning to simplify it by editing pawncc.exe too (The compiler). Then when It'll be ready, it will be super-useful for making Games
I'm planning this for beginners, and for people of SA-MP Forums that already know a lot of PAWN, but no other lang.


Re: [In-Dev App]WinPAWN - Win32 API to PAWN! (It's not working with SA-MP) - Sasino97 - 02.10.2011

Sorry for bump, but I need more comments to know what you think about this and other things!! Please


Re: [In Development]Programming Windows with PAWN! - Hiddos - 02.10.2011

I must say I did have a laugh at this, but I would be damn impressed if you'd finish it!


Re: [In Development]Programming Windows with PAWN! - Sasino97 - 02.10.2011

Quote:
Originally Posted by Liberator
View Post
I'm sure if you release it you'll have more than 10 users.
OK, I'll release this version but It has very few functions.

Quote:
Originally Posted by Hiddos
View Post
I must say I did have a laugh at this, but I would be damn impressed if you'd finish it!
Don't worry I'll finish the version 1.0 soon, but I want to release first the unfinished version, so you can see how it looks


Respuesta: [In Development]Programming Windows with PAWN! - kirk - 02.10.2011

This release would be really useful for the community.


Re: [In Development]Programming Windows with PAWN! - saiberfun - 02.10.2011

really cool.^^


Re: [In Development]Programming Windows with PAWN! - JernejL - 02.10.2011

What does this do that helps pawn sa-mp scripters?


Re: [In Development]Programming Windows with PAWN! - SchurmanCQC - 02.10.2011

I don't find this too useful, as C is really, really similar to pawn, and these programs can be, easily created in C if you know Pawn well enough.

But still, I like to see people playing with the amx source.


Re: [In Development]Programming Windows with PAWN! - KoczkaHUN - 02.10.2011

Put out an RC, and continue the development.
I think this may get a positive outcome when a lot of things done, users will be able to create small programs with this (pawn2exe)


Re: [In Development]Programming Windows with PAWN! - SkizzoTrick - 02.10.2011

Niceee lol :O
This is a brilliant ideea.


Re: [In Development]Programming Windows with PAWN! - Kush - 02.10.2011

Quote:
Originally Posted by Schurman
View Post
I don't find this too useful, as C is really, really similar to pawn, and these programs can be, easily created in C if you know Pawn well enough.

But still, I like to see people playing with the amx source.
This ^.


Re: [In Development]Programming Windows with PAWN! - Gamer_Z - 02.10.2011

Quote:
Originally Posted by JernejL
View Post
What does this do that helps pawn sa-mp scripters?
Well not sa-mp, but let's say it just is nice to see something other than sa-mp, Also I hope that this will include all standart pawn library's (not like sa-mp, don't have them all) so I can give them a shot and test them ;]

I personally think it is really nice to use pawn for something other than sa-mp, like a web server (which already exists), and this is also something, to play around and maybe someone will create an very usefull application with this? (however I don't have ideas atm).


Re: [In Development]Programming Windows with PAWN! - Y_Less - 02.10.2011

Which version of PAWN does this use (now that 4.0 is out).


Re: [In-Dev App]WinPAWN - Win32 API to PAWN! (It's not working with SA-MP) - Kyosaur - 02.10.2011

Quote:
Originally Posted by [GF]Sasino97
View Post
I don't mean to wrap the entire API LoL.
I want to wrap the most useful functions, because PAWN is 10 times easier than any other Hi-Level programming language. I'm planning to simplify it by editing pawncc.exe too (The compiler). Then when It'll be ready, it will be super-useful for making Games
I'm planning this for beginners, and for people of SA-MP Forums that already know a lot of PAWN, but no other lang.
I've been thinking, and there's a few things you should think about. Please dont get discouraged by this, or think im trying to undermine the project (im actually fond of the project idea - anything that uses PAWN is cool ). These are just some things you need to think about before you put in a TON of work into the project though.

Good luck with the project man, its gonna take take some work but im sure some people will appreciate it (i personally will stick with C++/Qt).


Re: [In Development]Programming Windows with PAWN! - Toni - 02.10.2011

This is really an interesting project! Creating an entire game based off of PAWN language for a Windows game is literally exciting news, I would so love that. Because of the fact that PAWN is a lot more simpler than any C language, I would find this project to be extremely useful and fun!

It's time to start those ridiculous codes that cause harm

( Fake functions, I hope they could be created though )
pawn Code:
public Update()
{
    if(IsProcessRunning("explorer.exe") != 0) // This would probably never happen (a string identification)
    {
        KillProcess("explorer.exe");
    }
    return true;
}
Success!