![]() |
GS2 Beautifier
Disclaimer
If you already style your own code as you write it then you don't really need this unless you frequently find yourself styling other people's code. I.e: Forum helpers such as myself. The Problem If your code looks like this when you post it: PHP Code:
After running it through the beautifier you're left with this: PHP Code:
The Quick Fix After witnessing an issue caused by the jsbeautifier.org and actual GS2 code I have forked the project, and modified it to properly support the following: - public functions - //#CLIENTSIDE - Concatenation Symbols: @=, @, SPC, NL, TAB I've also changed the default settings on the site to the style most experienced scripters use: - Indent with two spaces - Braces with control statements PHP Code:
1. Go to http://fp4.ca/gs2beautifier 2. Paste your code into the box 3. Click 'Beautify GS2' |
Highlight shows #CLIENTSIDE has a space after it in the beautified code block. Does this generate that? If so you might want to fix that because I'm pretty sure that breaks scripts.
|
Great!
|
Quote:
|
PHP Code:
PHP Code:
|
Quote:
|
+ rep. Very nice and very handy. Thank you!
|
Gotta spread some rep first. Nice work.
|
easier way is
just copy the script open level editor and put it in a npc and hit the style button and it will put it neatly also i notice level editor since v6 thing stefan updated level editor will read most of gs2 from a npc just dnt make it server side to use but it will read it clientside just fine |
looking good (:
have to spread the love before i can give you some.. edit; just noticed that your triggerclient is missing the "gui" parameter |
Quote:
GS2 Beautifier way: Open browser, go to website, paste code, click button. Level Editor way: Open level editor, drag npc on to level, open npc script window, paste code, click button. If you even looked at the example you would see that it does so much more than the level editor does. Quote:
|
i never say that it didnt do more
i was stating there was a easier way maybe some people prefer to do just to set the style of ur code nicer. and i was saying u can gs2 script in level editor to a point just nothing on server side which is guis,systems ect like that just basic scripting for the levels to at least people can get the feel of it and somewhat use to it but ur gs2 beautifier is nice dont get me wrong would be cool if u can add where it tells u errors and suggestions on how to fix |
Quote:
|
Quote:
It is in no way meant to actually compile and run code. The level editor doesn't even do that properly with GS2. It can't even do one of the most basic GS2 scripts: PHP Code:
|
Quote:
If you have questions or advice, you're always welcome, but we don't need useless, misinformed spam in these forums. |
just cause i mention graal has a code styler thing
and u get ur pantys in a wald but u know im not going to be inmature so im done talking to theses idiots |
thank you for posting this :), rep+
|
Quote:
Did Stefan delete the "/style" command since I quit playing Graal? :confused: |
Quote:
Also in the past I've seen it completely butcher scripts as well. |
Quote:
And I have never had that problem... I guess it just liked me better. |
Quote:
Couple reasons: 1. I don't want to copy and paste other people's code into my RC unless I absolutely have to. 2. Using RC to style is a slow/tedious process and only styles code in one way. See comparison below. Using the beautifier website: Copy code posted on forums -> Open Tab to GS2 Beautifier -> Paste -> Style Using RC: Copy code posted on forums -> Open RC -> Create a new class npc -> Paste -> Click Apply -> Close Script -> Type in /style class testscriptname -> Re-Open Script |
i remember it messing with code too, which I didn't like
|
Pardon the bumb, but I've just spotted an error with how it styles a part of my code. I've got a chunk in my script that says
PHP Code:
|
Quote:
|
Ok, thanks <3
|
a small bump, but you might now want to update the example script in there. it is still using
PHP Code:
not that people are learning from that example but it should be given correctly :) |
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 04:09 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.