ASCII

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1882
Joined: Sat Feb 23, 2008 11:15 pm

ASCII

Post by Kjell »

8)

Quick & dirty string to ascii converter written in html + javascript. Paste the results using the edit dialog of a Array Component in ZGE.

Code: Select all

<form name="ascii">
	<input name="string" type="text" />
	<input type="submit" value="Convert" />
</form>
<form name="hidden">
	<input name="locate" type="hidden" />	
</form>
<script type="text/javascript">
	document.hidden.locate.value = window.location;
	
	var param = document.hidden.locate.value;
	var index = param.indexOf("string=");
	
	if(index != -1)
	{
		var length = param.length;
		var string = param.substring(index+7,length);
	
		string = unescape(string);
	
		for(i=0; i<string.length; ++i)
		{
			var ascii = string.charCodeAt(i);
			if(ascii == 43)ascii = 32;
			document.write(ascii);
			if(i < string.length-1)document.write(", ");	
		}
	}
</script>
Please report any errors / requests.

K
Attachments
ASCII.zip
(442 Bytes) Downloaded 474 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

nice! Thanks for this.

73,84,69,82,65,84,73,79,78,71,65,77,69,83,46,67,79,77
iterationGAMES.com
Post Reply