PDA

View Full Version : [Tool/Web/Other] PAWN Playground - Online code runner


Slice
31/01/2012, 02:25 PM
Hey,

So I've finally managed to get a proper Linux compiler working, which allows me to use my Ubuntu VPS to both compile and run code.

Here's a tool I've been working on a little bit, which allows you to instantly write and test code without having to compile it and start the server/reload a FS/reload the GM. The output is limited to that of print and printf, though.

Have a look: http://slice-vps.nl:7070/

System64
31/01/2012, 02:31 PM
fuck yeah, fucking awesome :DD

I suggest you should add new includes, like YSI package etc...

Slice
31/01/2012, 02:34 PM
Yeah, that's what I had in mind. Checkboxes for certain includes/plug-ins that will make them included.

CaHbKo
31/01/2012, 02:37 PM
I sometimes use PAWN for solving real life problems, like counting, sorting something. And compiling a gamemode each time and running it wasn't really convenient. (if doing such thing is convenient/smart at all)

Now it's just one button away. Thanks!

And would you add plugin support? (CSTL for example)

EDIT:
You were a bit faster. :p

[Nikk]
31/01/2012, 04:58 PM
Awesome, like always, good work.

John Rockie
31/01/2012, 06:52 PM
Looks nice. Will try it.

Konstantinos
31/01/2012, 06:57 PM
Looks awesome Slice!
Good Job. I like it! :D

Slice
01/02/2012, 04:43 PM
Updates!

Lots of new stuff.. One cool feature is Pastebin integration - you can save and link to code by clicking just a button!

Example:
http://slice-vps.nl/ppg/?paste=xgDrkkXJ

:D

Niko_boy
01/02/2012, 04:48 PM
YEAH!!
I <3 this work of you Slice !!
Keep it up!! , and really lol its a pawno hardcore playground :p

aminj
01/02/2012, 04:48 PM
wow fucking awesome man :D good job :)

Slice
01/02/2012, 04:51 PM
Thanks, and I wouldn't say it's a "hardcore playground". It really is what you make it. For example, if you're having trouble with strfind you could just use this to quickly mess around with it and hopefully find the root to your problem!

Max_Coldheart
01/02/2012, 05:00 PM
I put
for(new i = 0; i < 100; i++)
{
if(i == 99)
{
i = 0;
}
print("Livin la vida loca");
}
Eventually my browser crashed :(

Slice
01/02/2012, 05:01 PM
Get (http://www.apple.com/safari/) a (http://www.mozilla.org/) better (http://chrome.google.com/) browser (http://www.opera.com/). :)

Konstantinos
01/02/2012, 05:05 PM
I put
for(new i = 0; i < 100; i++)
{
if(i == 99)
{
i = 0;
}
print("Livin la vida loca");
}
Eventually my browser crashed :(

Is it like this?

#include <a_samp>

main ()
{
for(new i = 0; i < 100; i++)
{
if(i == 99)
{
i = 0;
}
print("Livin la vida loca");
}
}

It works.

// Output:
[18:05:55] Livin la vida loca
[18:05:55] Livin la vida loca
[18:05:55] Livin la vida loca
[18:05:55] Livin la vida loca
[18:05:55] Livin la vida loca
// Continues ( very big )
[18:05:57] Livin la vida loca
[18:05:57] Livin la vida loca
[18:05:57] Livin la vida loca
[18:05:57] Livin la vida loca
[18:05:57] Livin la vida loca
[18:05:57] Livin la vida loca
[18:05:57] Livin la vida loca
[18:05:57] Livin la vida loca

_DownLoaD_
01/02/2012, 07:50 PM
Nice Job!
can i see the PHP script in private message?

Gamer_Z
01/02/2012, 10:41 PM
I'm curious about the linux compiler, the php script is easy to make and to set it up, but the most interesting part is the compiler..
Will you release the compiler? (I don't mind if you don't include the source)

Slice
02/02/2012, 07:31 AM
Download the compiler v3.2.3664 and replace SOURCE/COMPILER/sc2.c with this (http://pastebin.com/U3sTdU55) and you're all set!

Gamer_Z
02/02/2012, 07:36 AM
Download the compiler v3.2.3664 and replace SOURCE/COMPILER/sc2.c with this (http://pastebin.com/U3sTdU55) and you're all set!

thank you for the info, will try asap I'm home :p

Slice
02/02/2012, 07:33 PM
Sneak-peek of some awesome new features!

You can now see a nicely formatted assembler output, arranged in blocks by the line they came from. You can also click them to have that line highlighted!

Try it on:
http://slice-vps.nl/ppg/new.php (http://goo.gl/8zpHy) (press "Show assembler output" then click inside the outputted assembly code)

Cadetz
02/02/2012, 08:37 PM
This is really aweomse. Nice work :]

Amit_B
02/02/2012, 08:43 PM
Wow, really useful. Thanks.

Lorenc_
03/02/2012, 10:11 AM
subscribed <3

Programie
18/02/2012, 12:47 PM
Download the compiler v3.2.3664 and replace SOURCE/COMPILER/sc2.c with this (http://pastebin.com/U3sTdU55) and you're all set!
That's what I've searched! Thank you!!!

lolumadd_
18/02/2012, 04:13 PM
Will this be open source? Nice job btw!

Slice
18/02/2012, 04:19 PM
Eventually, it will. :D

TheGamer!
10/03/2012, 11:38 AM
LoL

[12:39:05] Starting...
[12:39:05] Number of vehicle models: 0
[12:39:06] One second has passed, and server shutting dowm.

LoL ever shows:

[12:49:13] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[12:49:13] Script[gamemodes/gm.amx]: Run time error 20: "Invalid index parameter (bad entry point)"

Neo_
10/03/2012, 12:29 PM
Damn ! Thats Awesome !

Slice
10/03/2012, 02:35 PM
LoL

[12:39:05] Starting...
[12:39:05] Number of vehicle models: 0
[12:39:06] One second has passed, and server shutting dowm.

LoL ever shows:

[12:49:13] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[12:49:13] Script[gamemodes/gm.amx]: Run time error 20: "Invalid index parameter (bad entry point)"

what?

Calgon
10/03/2012, 02:39 PM
Wow, thank you!

Sorry, I couldn't resist:

http://puu.sh/kc1H

Good idea to kill the server after 2 seconds.

robintjeh
11/03/2012, 10:44 AM
SLICE! WOW! Thank you for this! I can finally script on my phone without beiing to any limits on it! YEAH!

Slice
13/03/2012, 02:13 PM
Pssst.. if you're trying to get a hang of using #emit (AMX assembly), you should click "Show assembler output" in the new version of PPG (http://slice-vps.nl/ppg/new.php), then you'll be able to click on "Show assembler output" and see which line produces what AMX opcodes (the assembler output is also grouped in subtle groups based on which line they're from.

Slice
25/04/2012, 01:02 PM
Couple new updates:

You can now save scripts very easily then link back to them.
You can see the preprocessed output (the code after all macros have been parsed, essentially).
You can see the assembler output (#emit stuff).
Most parts of the assembler output is clickable, and you will see which line the instructions come from.
All opcodes (LOAD.pri, for example) can now be clicked and a hint explaining what they do wil appear.


http://slice-vps.nl/ppg/ss1.png




http://slice-vps.nl/ppg/ss2.png

Spooky
27/04/2012, 04:23 PM
Awesome work dude, add color codes same like pawno and add some new features and add default new.pwn

Slice
27/04/2012, 05:19 PM
There is a default "new.pwn". It's very slim because you're supposed to be able to quickly test things without having to delete a bunch of code.

There is already syntax highlighting? If that's what you mean.

[DOG]irinel1996
27/04/2012, 06:43 PM
You're making a GREAT/AWESOME/AMAZING job, no doubt about that.
I'll be able to script in all places. :)

Hiddos
02/05/2012, 12:20 PM
This is too damn underrated. Using it at least twice a week without needing to open up Pawno, creating a seperate filterscript, starting a local server and loading the script. 100% win!

Slice
18/06/2012, 12:21 PM
I'm now working on adding step-by-step debugging of macros!

Go to the link below and hit "Show preprocessed output":
http://slice-vps.nl/ppg/#gist=14eb8e0598e1f1c6cbc5

Extremo
18/06/2012, 12:27 PM
I'm now working on adding step-by-step debugging of macros!

Go to the link below and hit "Show preprocessed output":
http://slice-vps.nl/ppg/#gist=14eb8e0598e1f1c6cbc5

I am loving it. Now once your down with it you should make an offline IDE with the same functionality haha :P

That is so much easier than reading all those #defines tho =)

Blunt
18/06/2012, 12:43 PM
Thats really nice, would be awesome if you could make an application for it.

JaTochNietDan
18/06/2012, 01:40 PM
Hey,

So I've finally managed to get a proper Linux compiler working, which allows me to use my Ubuntu VPS to both compile and run code.

Here's a tool I've been working on a little bit, which allows you to instantly write and test code without having to compile it and start the server/reload a FS/reload the GM. The output is limited to that of print and printf, though.

You can easily have your code posted on GitHub's Gist, and with a link have people see that code in PAWN Playground; example: http://slice-vps.nl/ppg/#gist=e1671ed540af535f8cc7

Have a look: http://slice-vps.nl/ppg/ (http://goo.gl/geHGA)

First time I've noticed this release Slice. Good work, now I can do some quick tests without having to open my editor and run the SA-MP server to see the output, just makes testing code a bit quicker :)

Jonny5
18/06/2012, 02:52 PM
wow i did not know this showed the assembler output!
this could help with learning emit codes.

Also like how you can see the pre-processed output!
This should help with making marcos.

Slice
18/06/2012, 05:45 PM
wow i did not know this showed the assembler output!
this could help with learning emit codes.

Also like how you can see the pre-processed output!
This should help with making marcos.

Yeah, you can also see which line assembly instructions are from, and step-by-step how macros are being replaced. See previous posts in this topic.

Jonny5
19/06/2012, 03:54 AM
I looked at that demo of yhash and was amazed!
This is a great learning/development tool
its a shame i cant give you more rep(said i must spread it around :mad:) as it is highly deserved for this one!


on a side note,
the editor does not show me all lines of code.

if i paste 115 lines I can only see 110
this in on the latest Chrome.

thanks again!

Slice
19/06/2012, 05:02 AM
Thanks. I'll fix that.

Edit: Fixed.

silvan
19/06/2012, 08:22 AM
Is this gonna support all the functions? and can work like normal pwn? cause it will be awesome and very worth it to use. like you have a server and you can edit and upgrade / work on bugs etc from everywhere around the world. without having your own pc on if its in a host.

Extremo
19/06/2012, 06:42 PM
Is this gonna support all the functions? and can work like normal pwn? cause it will be awesome and very worth it to use. like you have a server and you can edit and upgrade / work on bugs etc from everywhere around the world. without having your own pc on if its in a host.

I am just gonna have a guess thats already possible since he ported the compiler to linux.

EDIT: I even use this tool for when I work with pre-processors in C++. It's an understatement if I were to say this tool is useful. It's amazing how much it simplifies the work for me and even with the most complicated #defines I don't need to compile it to see what could or might be wrong. Love it.

Slice
01/07/2012, 04:05 PM
I've decided to re-write PPG completely and open-source it (you'll find it on my GitHub soon).

Sneak-peek of the new interface (iPad friendly, psst psst):
http://slice-vps.nl/ppg-new/

I haven't worked on full cross-browser support yet. It performs best in Chrome or Safari.

The auto-complete is triggered by Esc or Ctrl+Space.
Typing "emit, def, undef, pub, fwd" automatically resolves to "#emit, #define, #undef, public, forward".
Auto-complete for #emit instructions.
Press enter or press something in the auto-complete list to insert it.

Calgon
01/07/2012, 11:07 PM
How do you compile/run now? I see no buttons for it.

Slice
02/07/2012, 05:08 AM
Right now it's just a new back-end and front-end. I haven't connected them together yet.

Patrik356b
06/07/2012, 04:57 PM
Nice one Slice

Xentiarox
25/07/2012, 09:57 PM
Download the compiler v3.2.3664 and replace SOURCE/COMPILER/sc2.c with this (http://pastebin.com/U3sTdU55) and you're all set!

woth that sc2.c I just have 2 problems:



./variables/global.inc(352) : error 001: expected token: "-string end-", but found "-identifier-"
./response_receivers/dialogs.inc(15 -- 19) : error 001: expected token: "-string end-", but found "-identifier-"
./response_receivers/dialogs.inc(34 -- 38) : error 001: expected token: "-string end-", but found "-identifier-"
./response_receivers/dialogs.inc(43 -- 47) : error 001: expected token: "-string end-", but found "-identifier-"
./response_receivers/dialogs.inc(62 -- 66) : error 001: expected token: "-string end-", but found "-identifier-"
./response_receivers/dialogs.inc(72 -- 76) : error 001: expected token: "-string end-", but found "-identifier-"
./response_receivers/dialogs.inc(91 -- 95) : error 001: expected token: "-string end-", but found "-identifier-"
./response_receivers/dialogs.inc(102 -- 106) : error 001: expected token: "-string end-", but found "-identifier-"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.



In the normal sa-mp compiler it compiles good.

This is the code:
<dialogs.inc lines 15...20>

ShowPlayerDialog(
playerid,
DLG_REG_2,
DIALOG_STYLE_INPUT,
TXT_DLG0_002
);


and global.inc:

new VehicleNames[611][24] =
{
(...)
"StairTrailer",
"Boxville",
"FarmPlow",
"UtilityTrailer"//<-here is the error
};


can you fix it, please?
also could you take a look at this topic:
http://forum.sa-mp.com/showthread.php?t=362860
Maybe you know a fix? :$

Slice
26/07/2012, 06:04 AM
I'm not sure - I've tried too long to get that compiler working, I don't want to spend any more time trying.

MadeMan
02/09/2012, 01:14 PM
Helps to get to know PAWN better :D
Good job.

[HK]Ryder[AN]
04/09/2012, 03:34 PM
ERROR: Running AMX files is currently disabled. Sorry!

why is this coming?

Slice
04/09/2012, 05:13 PM
Because running AMX files is currently disabled for security reasons.

[HK]Ryder[AN]
04/09/2012, 05:14 PM
k.Quick Reply :D

eLiTe.
06/02/2013, 05:17 PM
Site offline?...

Slice
07/02/2013, 01:37 PM
It's down at the moment, yeah. Sorry about that.

I'm working on getting it up and running; however, I must find a solution to safely running the samp server (on Debian). Now with Zeex's latest creations you can run machine code in PAWN, which unfortunately is something people could abuse.

Suggestions, anyone?

Slice
13/02/2013, 12:28 AM
As a complement, I've started to working on a portable version of PPG.

You will use it like PAWNO, except it runs in your browser. Running servers and everything will be supported not only on Windows, but also for Linux and OS X.

You'll find it on my GitHub (https://github.com/oscar-broman) soon!

czerwony03
06/04/2013, 03:21 PM
I have problem with your prawn:
/home/prawn/lib/prawn/1-pre-pre.js:52
if (result.errors) {
^
TypeError: Cannot read property 'errors' of undefined
at /home/prawn/lib/prawn/1-pre-pre.js:52:15
at /home/prawn/lib/pawnc.js:342:16
at /home/prawn/node_modules/async/lib/async.js:227:13
at /home/prawn/node_modules/async/lib/async.js:107:25
at /home/prawn/node_modules/async/lib/async.js:24:16
at /home/prawn/node_modules/async/lib/async.js:224:17
at /home/prawn/node_modules/async/lib/async.js:507:34
at Socket.<anonymous> (/home/prawn/lib/pawnc.js:328:13)
at Socket.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:883:14
Can you help me??

Slice
08/04/2013, 01:09 PM
I have problem with your prawn:
/home/prawn/lib/prawn/1-pre-pre.js:52
if (result.errors) {
^
TypeError: Cannot read property 'errors' of undefined
at /home/prawn/lib/prawn/1-pre-pre.js:52:15
at /home/prawn/lib/pawnc.js:342:16
at /home/prawn/node_modules/async/lib/async.js:227:13
at /home/prawn/node_modules/async/lib/async.js:107:25
at /home/prawn/node_modules/async/lib/async.js:24:16
at /home/prawn/node_modules/async/lib/async.js:224:17
at /home/prawn/node_modules/async/lib/async.js:507:34
at Socket.<anonymous> (/home/prawn/lib/pawnc.js:328:13)
at Socket.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:883:14
Can you help me??

I would prefer you make an issue here (https://github.com/oscar-broman/Prawn/issues).

As for that error, it seems the compilation fails (pawncc is never executed, I suspect). I'll patch that error and update the Git repo.

Slice
05/08/2013, 03:48 PM
Sneak-peek of the new version: http://slice-vps.nl:7070/

GitHub repo: https://github.com/oscar-broman/ppg

-Prodigy-
05/08/2013, 03:53 PM
Page doesn't load for me

Slice
05/08/2013, 05:19 PM
Oops, firewall. Try now.

Y_Less
05/08/2013, 06:00 PM
I've got nothing!

Slice
05/08/2013, 07:49 PM
Oh, err, clearly I need to do more testing on Linux.

PT
07/08/2013, 03:40 AM
Good Job Slice :D

JernejL
24/08/2013, 12:01 PM
Website is down, again.

Slice
24/08/2013, 12:36 PM
Website is down, again.

http://slice-vps.nl:7070/

I forgot to update the main page.

ProjectMan
24/08/2013, 02:16 PM
#include <a_samp>

main() {
SetTimer("Test", 250, true);
}

new i;

forward Test();
public Test() {
i = i + 1;

switch (i)
{
case 1: {print("S");}
case 2: {print("L");}
case 3: {print("I");}
case 4: {print("C");}
case 5: {print("E");}
case 6: {print(" ");}
case 7: {print("R");}
case 8: {print("O");}
case 9: {print("X");}
case 10: {print("!");}
case 12: {print(" ");}
case 13: {print("Y");}
case 14: {print("O");}
case 15: {print("U");}
case 16: {print(" "), i = 6;} //His useful tip xD
}

}

ArkoUK
08/09/2013, 11:46 AM
Really nice work.

Sp3cter
10/09/2013, 04:13 PM
Infinite loops crash your script. :d

Slice
03/02/2014, 03:10 PM
Recent updates

Save code into "files" (saved in the browser's local storage). Soon the Pastebin-like feature will be back where you can publish the code.
Integrate with samp-introspect so you can run code while the server is running. Currently native functions can not be directly called because of issues with crashdetect.
Performance improvements
Keybinds
Server run time limited to 120 seconds instead of 5 seconds

Y_Less
03/02/2014, 04:40 PM
I managed to crash it with this:


printf("hello %d", &42);


I'm not sure yet if that's my fault in exec.inc, or the issue with crashdetect you mentioned. The fact that the error was in "SysreqDN", which I wrote, is not reassuring:


[debug] Server crashed while executing gm.amx
[debug] AMX backtrace:
[debug] #0 0000a2e4 in ref (... <1 argument>) at include/amx/dynamic_call.inc:383
[debug] #1 00014810 in Exec_ToHeap (value=42) at include/samp-introspect/exec.inc:218
[debug] #2 00016b70 in ?? (... <790079 arguments>) at include/samp-introspect/exec.inc:396
[debug] #3 fffeef74 in ?? (... <34 arguments>) at include/float.inc:177
[debug] #4 0025f28c in public OnRconCommand () at input.pwn:24


In my local copy at least that is this:


while (--i >= end) {
arg = g_args[i]; // THIS LINE.
#emit push.s arg
}


Actually, thinking about it, I'm not sure I've ever tested variable argument functions with the new parser.

But I like the local file saving - any chance for some more remote saving so we can share things?

Slice
03/02/2014, 06:55 PM
About sharing - yes, I plan to integrate it with GitHub Gist.

It crashes when invoking any native function, it seems, and it only happens when crashdetect is loaded. I'm not entirely sure where the problem resides, but I'm trying to figure it out.

Slice
05/02/2014, 01:21 PM
Ahhhh, the samp-introspect integration works perfectly now!

Y_Less
05/02/2014, 01:22 PM
Excellent. I've already been using this for rapid prototyping of code - paste it in there and use the console thing to query values, call functions, and manually check results.

Crayder
02/03/2014, 08:08 AM
This is awesome! How did I not see this before!

Niko_boy
30/03/2014, 10:17 AM
Can i still get Assembly output using this ? or removed :/ ?

Slice
30/03/2014, 10:38 AM
Can i still get Assembly output using this ? or removed :/ ?

Still works here: http://slice-vps.nl/ppg/

Slice
17/04/2014, 08:24 AM
I just pushed many updates to PPG on my VPS!


New, improved editor (syntax highlighting, milti-line editing, auto-closing brackets, and more..)
Compiler warnings/errors are displayed in the gutter next to line numbers
Undo/redo history is saved when switching documents, and even when closing the web browser.
Improved stability
PPG will sync between multiple tabs, even if you're editing the same document


The save button is gone, as you might notice. That's because documents are automatically saved (1 second after you stop typing). Now with the saved undo/redo history this shouldn't be a problem.

http://i.imgur.com/iWySI6f.png

Planned features:

Loading and saving documents from GitHub Gist (like Pastebin)
Assembler output
Single-step macros