• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

bbcode gui for starcraft 2

Status
Not open for further replies.
Level 6
Joined
Jun 4, 2009
Messages
91
hi,

I developed a nice GUI parser for starcraft 2 triggers.
It can parse trigger, but also custom actions, events, conditions, function, records and preset. It'll automatically detect which kind of code you give.

Here is a sample: http://bwef.co.cc/sf1-warcraft-iii-sf/reglement-news-infos-f36/bbcode-gui-pour-sc2-t239.html

Just ask me if you want the code to add it to the hive.
Notice: I'm actually too lazy to configure it to work with English editor locales, but it can easily be.
 
Level 6
Joined
Jun 4, 2009
Messages
91
Well, for now, I share the parser only with big sites to keep credits (it will be open source on 27/07...).

EDIT: you can look at the locales files in the attachments and contribute if you want.
for now there is:
->en-en
->fr-fr


But you can use the remote parse feature I made

Hum... now aware of cross domains issues.
Use this to bypass: let's call it remote_parser.js
Code:
// configure remote parser url
var sc2remoteparser = 'http://bwef.co.cc/parsesc2gui.php';
var proxy_url = 'http://127.0.0.1/remote_parser/proxy.php' // change this to the proxy url on your domain. You'll find the file in remote_parser.zip
// configure ajax
var sc2http_request = getHTTPObject();


function sc2RemoteParse(o)
{
	sc2http_request.open("POST", proxy_url+'?proxy_url='+sc2remoteparser, false);
	sc2http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  	sc2http_request.send("source="+escape(o.innerHTML.replace(/<br>/gi, "\n").replace(/&nbsp;/g, ' ')));
	
	if (sc2http_request.status == 200)
	{
		o.style.lineHeight = '0px';
		o.innerHTML = sc2http_request.responseText;
	}
	else
	{
		o.innerHTML = 'There was an error: '+sc2http_request.status+'. please report';
	}
	
}

function sc2ParseEverything()
{
	var items = document.getElementsByTagName('div');
	for(var i=0; i<items.length; i++)
	{
		if (items[i].className === 'sc2gui')
			sc2RemoteParse(items[i]);
	}
}

function getHTTPObject()
{
	if (window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';
	}
}

1) include those javascripts and styles in your page's headers (before the contents):
HTML:
<script type="text/javascript" src="PREVIOUS JS FILE YOU CREATED"></script>
<script type="text/javascript" src="http://bwef.co.cc/styles/Galaxy.js"></script>

<style>
.sc2gui
{
	font-size: 11px;
	font-family: Tahoma, Arial;
	background-color:#ffffff;
	border:solid 1px black;
	padding:5px;
	margin:2px;
	overflow:auto;
	white-space: nowrap;
}

div.trghide
{
	display: none;
}

img.trg
{
	border:0 none;
	height:16px;
	vertical-align:middle;
	width:16px;
}
</style>

2) at the bottom of your page (after the content):
HTML:
<script type="text/javascript">
sc2ParseEverything();
</script>

and the ajax script will ask my website to parse every contents within
HTML:
<div class="sc2gui">...content...</div>
and replace with the result.


IF YOU WANT IT TO WORK WITH IE (lol?): use '&nbsp;' instead of spaces, and '<br>' instead of "\n"
 

Attachments

  • actions.txt
    5.8 KB · Views: 186
  • labels.txt
    791 bytes · Views: 131
  • options.txt
    558 bytes · Views: 109
  • prefixs.txt
    140 bytes · Views: 118
  • remote_parser.zip
    5 KB · Views: 76
Last edited:
Level 6
Joined
Jun 4, 2009
Messages
91
There is how should look bbcode on phppbb (and with some little differences, on other forums).

To convert spaces into &nbsp; (only if you want it to work with IE... firefox will work very well without doing this) you may edit both include/message_parser.php and include/bbcode.php and add the bbcode in the core instead of adding into the database.

parser_bbcode.jpg
 
Level 6
Joined
Jun 4, 2009
Messages
91
alright. If you need some help to install, just tell me.

Now, I fixed every bug I could have met (especially on IE...) and refreshed the style.

EDIT: can now display several triggers/actions... in a single DIV.
Now working on making a trigger selection on the left in this case
 
Last edited:
Level 6
Joined
Jun 4, 2009
Messages
91
ah vbulletin update broke it...

The update probably override class_bbcode.php and our modifications.

But I think you can do the same modifications to have it to work again:
http://bwef.co.cc/sf1-warcraft-iii-...starcraft-gui-bbcode-for-free-t247.html#p1022

skip style and javascript since they should still be here.
update global.php and includes/class_bbcode.php

I'll see with you or aaron when I'll meet on msn to find a way to hook cleanly, so it remains even after updates.

I'm going to think about it, but I don't have vbulletin, so it's like a blind trying to see...
 
Level 6
Joined
Jun 4, 2009
Messages
91
Product now tested, updated and working ! (see full vbulletin installation)
http://bwef.co.cc/download/file.php?id=78

remember you can download the latest parser version here
http://bwef.co.cc/sf1-warcraft-iii-...d-the-starcraft-gui-bbcode-for-free-t247.html

EDIT: since now, you can do more than only copying a trigger, I felt good to build this little "manual":

the syntax is easy:
for each unindented line, it creates an element on the left (if no line is indented, then, they can be assumed to be listed actions. But it may fail to parse correctly if you add globals or comments)
for each indented line, it binds to the previous unindented element

then, the parser try to find out which type of element it is:
elements without binded data: folders, labelled folders, globals, "global" comments
elements with binded data: triggers, custom action, condition, events, records, presets

Now, if your element doesn't have binded data, the parser will determine according to this:
a folder looks like this: "a folder/a nested folder/" (nested folders are fully supported everywhere)
a labelled folder: "a labelled folder/ LABEL"
a global: "a folder/global <type>" or "global <type>"
a global comment: "a folder/------- comment" or "------- comment"

If the element have binded data, the parser won't use previous rules, but those ones:
folder gets parsed (it can be mentioned for the first time)
after the /, it's the trigger's name.
according to next line, the parser determines the type (default is trigger)

So, with binded data, even if your elements looks like a global:
"a folder/global <type>"
will create a trigger named global <type> in "a folder"
 
Last edited:
Status
Not open for further replies.
Top