wc3 tag

dorbian

New Member
Reaction score
1
As i had no clue on where to put this, i think this is the best possible location :)

I have a personal wiki which i use for all my programming snippets, as i code in many different languages the syntax highlighting makes my life easier.
Now for Warcraft 3 i noticed that TheHelper is using the wc3 tag on the forum, but i have no clue on where to find this..

is it publicly available somewhere or was it custom build for specifically this site, and is it possible to get a copy of the system or the rules used ?

For JASS I've been busy making one for Geshi as it's widely supported and i hope to use it for both my blog and my snippet library.

Cheers,

-D
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
The wc3 tags for the forum were made by phyrex1an using the Geshi system, I believe. It will be up to him if he wants to offer you the coding, but I think this has been asked in the past and generally the answer is no.
 

dorbian

New Member
Reaction score
1
I can understand if he would refuse, i know how much work goes into building one.
Otherwise i can always have a look into building one myself :) ( as it would have been his idea i would credit him in the source as such if he wouldn't mind )

Cheers for the reply and i'll wait until he has replied himself before i do anything.

-D
 

Artificial

Without Intelligence
Reaction score
326
I made one myself two or three (or more?) years ago. The code might be a bit messy, and I don't really remember how it works (nor do I have much interest in reading through it), but it might be helpful for you if you manage to understand or use it.

PHP:
	function wc3_trigger($content) {
		// ----- Configuration
			$path     = '/Test/images/GUI/';
			$keywords = array('AI', 'Animation', 'Special Effect', 'Camera', 'Cinematic', '--------', 'Destructible',
							  'Dialog', 'Environment', 'Game Cache', 'Game', 'Neutral Building', 'Hero',
							  'Item', 'Melee', 'Player Group', 'Player', 'Quest', 'Leaderboard', 'Multiboard',
							  'Region', 'Set', 'Sound', 'Unit Group', 'Unit',
							  'Selection', 'Wait', 'Visibility', 'Actions', 'Then - Actions', 'Else - Actions', 'Loop - Actions',
							  'Conditions', 'If - Conditions', 'Countdown', 'Time', 'Custom script', 'Map initialization', 'Skip remaining actions', 'Trigger', 'Floating Text', 'Image', 'Lightning', 'Ubersplat', 'Do nothing'
							  );
			$images   = array('Actions-AI.jpg', 'Actions-Animation.jpg', 'Actions-Animation.jpg', 'Actions-Camera.jpg', 'Actions-Camera.jpg', 'Actions-Comment.jpg',
						  	  'Actions-Destructibles.jpg', 'Actions-Dialog.jpg', 'Actions-Environment.jpg', 'Actions-SetVariables.jpg', 'Actions-Game.jpg',
							  'Actions-Goldmine.jpg', 'Actions-Hero.jpg', 'Actions-Item.jpg', 'Actions-Melee.jpg', 'Actions-PlayerGroup.jpg',
							  'Actions-Player.jpg', 'Actions-Quest.jpg', 'Actions-Quest.jpg', 'Actions-Quest.jpg', 'Actions-Region.jpg', 'Actions-SetVariables.jpg', 'Actions-Sound.jpg',
							  'Actions-UnitGroup.jpg', 'Actions-Unit.jpg', 'Actions-UnitSelection.jpg', 'Actions-Wait.jpg', 'Actions-Visibility.jpg',
							  'Editor-TriggerAction.jpg', 'Editor-TriggerAction.jpg', 'Editor-TriggerAction.jpg', 'Editor-TriggerAction.jpg', 'Editor-TriggerCondition.jpg', 'Editor-TriggerCondition.jpg', 'Events-Time.jpg', 'Events-Time.jpg', 
							  'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 'Actions-Nothing.jpg', 
							  'unknown' => 'Actions-Logical.jpg', 'trigger' => 'Editor-Trigger.jpg', 'events' => 'Editor-TriggerEvent.jpg'
							  );
			$indentPics     = array('line.jpg', "joinbottom.jpg", 'join.jpg', 'empty.jpg');
			$indHtmlStart	= '<img class="inlineimg" alt="    " src="';
			$indHtmlEnd		= '" />';
			$highlight      = '@';
			$highlightStyle = 'background-color: yellow;';
			$htmlStart 		= '<img class="inlineimg" style="margin-right:5px;" alt="" src="';
			$htmlEnd		= '" />';
		// ----- End of Configurations
		
		$final		  = "";
		$tempStr      = "";
		$levels       = array();
		$hasBeenSeen  = array();
		$indentations = array();
		$lines        = explode("\n", $content);
		$lineCount    = count($lines);
		$prevWasEvent = false;
		$offset = 1000;
		
		// Removing the spaces and finding out the smallest level.
		for($i = 0; $i < $lineCount; $i++) {
			while (preg_match('/^@* {4}/', $lines[$i])) {
				$lines[$i] = preg_replace('/ {4}/', '', $lines[$i], 1);
				$levels[$i]++;
			}
			/*if (!isset($offset) AND $lines[$i] != "" AND $lines[$i] != NULL)
				$offset = $levels[$i];
			else*/
				if ($levels[$i] < $offset)
					$offset = $levels[$i];
		}
		
		// Now when the offset has been found out, let's fix the levels.
		for($i = 0; $i < $lineCount; $i++)
			$levels[$i] -= $offset;
		
		// Adding all the images and stuff.
		for($i = $lineCount - 1; $i >= 0; $i--) {
			$indentation = "";
			
			// Reset hasBeenSeen
			for($j = $levels[$i + 1] + 1; $j < $levels[$i]; $j++)
				$hasBeenSeen[$j] = false;
			
			// Setting the ones on the left
			for($j = 1; $j < $levels[$i]; $j++)
				if ($hasBeenSeen[$j])
					$indentation .= $indHtmlStart . $path . $indentPics[0] . $indHtmlEnd; // |
				else
					$indentation .= $indHtmlStart . $path . $indentPics[3] . $indHtmlEnd; // {empty}
			
			// Setting the image before the genre img.
			if ($levels[$i] > $levels[$i + 1]) {
				$indentation .= $indHtmlStart . $path . $indentPics[1] . $indHtmlEnd; // '-
				$hasBeenSeen[$levels[$i]] = true;
				
			} elseif ($levels[$i] == $levels[$i + 1] AND $levels[$i] != 0)
				$indentation .= $indHtmlStart . $path . $indentPics[2] . $indHtmlEnd; // |-
				
			elseif ($levels[$i] < $levels[$i + 1] AND $levels[$i] != 0)
				if ($hasBeenSeen[$levels[$i]])
					$indentation .= $indHtmlStart . $path . $indentPics[2] . $indHtmlEnd; // |-
				else {
					$indentation .= $indHtmlStart . $path . $indentPics[1] . $indHtmlEnd; // '-
					$hasBeenSeen[$levels[$i]] = true;
				}
				
			
			// Add the genre pic
			$wasFound = false;
			
			// If it should be the trigger name.
			if ($prevWasEvent) {
				$lines[$i] = $htmlStart . $path . $images['trigger'] .'" title="Trigger"'. $htmlEnd . $lines[$i];
				$prevWasEvent = false;
				$indentation = "";
			} elseif (preg_match('/^'. $highlight .'*Events/', $lines[$i])) {
				$lines[$i] = $htmlStart . $path . $images['events'] .'" title="Events"'. $htmlEnd . $lines[$i];
				$prevWasEvent = true;
			} else {
				for($j = 0; $j < count($images) - 3 AND !$wasFound; $j++) // There's 3 images that are not got with integers
					if (preg_match('/^'. $highlight .'*'. $keywords[$j] .'/', $lines[$i])) {
						$wasFound = true;
						$lines[$i] = $htmlStart . $path . $images[$j] .'" title="'. $keywords[$j] .'"'. $htmlEnd . $lines[$i];
					}
				if (!$wasFound)
					$lines[$i] = $htmlStart . $path . $images['unknown'] .'" title="Unknown"'. $htmlEnd . $lines[$i];
			}
			
			// Add to $final.
			$final = $indentation . $lines[$i] . "\n" . $final;
		}
		
		// $highlight isn't there for nothing!
		$inHigh = false;
		$temp = preg_split("/(". $highlight .")/", $final, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
		$final = "";
		
		// Two options for the highlighting.
		foreach($temp as $part)
			if ($part == $highlight) {
				if ($inHigh)
					$final .= '</span>';
				else
					$final .= '<span style="'. $highlightStyle .'">';
				$inHigh = !$inHigh;
			} else
				$final .= $part;
		
		return trim($final);
	}

For all I care, that code may be used freely for any purposes.

And these should be the images used for it: http://www.mediafire.com/?jherz20mkmt
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
You could ask TriggerHappy. A while ago, playdota.com needed Jass tags for its programming section. After asking tons of people and being redirected to each other. Finally, I was redirected to TriggerHappy who gave me his vBulletin plugin for Jass. You could for sure extract the code from it.

I'm not sure if he's still on these forums. You could try to catch him on other wc3 related websites.
 

dorbian

New Member
Reaction score
1
thanks :) i'm currently trying the code, doubt however that i'll use any code coloring for my blog, only for my snippet library.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top