<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://fenixwiki.booleansoup.com/skins/common/feed.css?63"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Tutorial:Textinput - Revision history</title>
		<link>http://fenixwiki.booleansoup.com/index.php?title=Tutorial:Textinput&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.10.1</generator>
		<lastBuildDate>Fri, 01 May 2026 07:52:20 GMT</lastBuildDate>
		<item>
			<title>Sandman: Textinput moved to Tutorial:Textinput: tutorial namespace</title>
			<link>http://fenixwiki.booleansoup.com/index.php?title=Tutorial:Textinput&amp;diff=3187&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;a href=&quot;/index.php/Textinput&quot; title=&quot;Textinput&quot;&gt;Textinput&lt;/a&gt; moved to &lt;a href=&quot;/index.php/Tutorial:Textinput&quot; title=&quot;Tutorial:Textinput&quot;&gt;Tutorial:Textinput&lt;/a&gt;: tutorial namespace&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 00:16, 9 August 2007&lt;/td&gt;
			&lt;/tr&gt;
		&lt;/table&gt;</description>
			<pubDate>Thu, 09 Aug 2007 00:16:22 GMT</pubDate>			<dc:creator>Sandman</dc:creator>			<comments>http://fenixwiki.booleansoup.com/index.php/:Textinput</comments>		</item>
		<item>
			<title>Sandman at 22:43, 6 August 2007</title>
			<link>http://fenixwiki.booleansoup.com/index.php?title=Tutorial:Textinput&amp;diff=3146&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 22:43, 6 August 2007&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;[[Category:tutorials]]&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;[[Category:tutorials]]&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;This isn't much of a [[tutorial]], rather some example code, but anyway. This code shows that text input in [[Fenix]] is not hard at all: with just a little piece of code, much can be achieved. Note that this is code for Fenix versions [[0.93]] and up.&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;This isn't much of a [[tutorial]], rather some example code, but anyway. This code shows that text input in [[Fenix]] is not hard at all: with just a little piece of code, much can be achieved.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;Note that this is code for Fenix versions [[0.93]] and up&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Should the code work for other versions as well, be so kind to note this here&lt;/ins&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;== Example code ==&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;== Example code ==&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 06 Aug 2007 22:43:48 GMT</pubDate>			<dc:creator>Sandman</dc:creator>			<comments>http://fenixwiki.booleansoup.com/index.php/:Textinput</comments>		</item>
		<item>
			<title>Sandman: comments</title>
			<link>http://fenixwiki.booleansoup.com/index.php?title=Tutorial:Textinput&amp;diff=2396&amp;oldid=prev</link>
			<description>&lt;p&gt;comments&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 01:54, 28 May 2007&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 40:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 40:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;    // pressing enter will end the loop&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;    // pressing enter will end the loop&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;    Loop&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;    Loop&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;        if(ascii!=0&amp;amp;&amp;amp;last_ascii==ascii) // check if a key is pressed and if the same key was pressed last frame&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;        if(ascii!=0&amp;amp;&amp;amp;last_ascii==ascii) // check if a key is pressed and if the same key&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;            if(t==0||t&amp;gt;fps/4) // check if the key was just pressed or it has been pressed for 0.25 seconds&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;                                        // &lt;/ins&gt;was pressed last frame&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;                if(t==0||t2&amp;gt;fps/30) // check if the key was just pressed or it has been pressed for the last 0.03 seconds&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;            if(t==0||t&amp;gt;fps/4) // check if the key was just pressed or it has been pressed&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;                              // &lt;/ins&gt;for 0.25 seconds&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;                if(t==0||t2&amp;gt;fps/30) // check if the key was just pressed or it has been pressed&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;                                    // &lt;/ins&gt;for the last 0.03 seconds&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;                    t2=0;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;                    t2=0;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;                    switch(ascii) // handle input&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;                    switch(ascii) // handle input&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 28 May 2007 01:54:42 GMT</pubDate>			<dc:creator>Sandman</dc:creator>			<comments>http://fenixwiki.booleansoup.com/index.php/:Textinput</comments>		</item>
		<item>
			<title>Sandman at 01:46, 28 May 2007</title>
			<link>http://fenixwiki.booleansoup.com/index.php?title=Tutorial:Textinput&amp;diff=2395&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 01:46, 28 May 2007&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;[[Category:tutorials]]&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;This isn't much of a [[tutorial]], rather some example code, but anyway. This code shows that text input in [[Fenix]] is not hard at all: with just a little piece of code, much can be achieved. Note that this is code for Fenix versions [[0.93]] and up.&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;This isn't much of a [[tutorial]], rather some example code, but anyway. This code shows that text input in [[Fenix]] is not hard at all: with just a little piece of code, much can be achieved. Note that this is code for Fenix versions [[0.93]] and up.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 28 May 2007 01:46:49 GMT</pubDate>			<dc:creator>Sandman</dc:creator>			<comments>http://fenixwiki.booleansoup.com/index.php/:Textinput</comments>		</item>
		<item>
			<title>Sandman at 01:46, 28 May 2007</title>
			<link>http://fenixwiki.booleansoup.com/index.php?title=Tutorial:Textinput&amp;diff=2394&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This isn't much of a [[tutorial]], rather some example code, but anyway. This code shows that text input in [[Fenix]] is not hard at all: with just a little piece of code, much can be achieved. Note that this is code for Fenix versions [[0.93]] and up.&lt;br /&gt;
&lt;br /&gt;
== Example code ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Program texts;&lt;br /&gt;
&lt;br /&gt;
Declare Function String textinput();&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Begin&lt;br /&gt;
&lt;br /&gt;
    set_fps(60,0);&lt;br /&gt;
&lt;br /&gt;
    say(&amp;quot;You typed: '&amp;quot; + textinput() + &amp;quot;'&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    Repeat&lt;br /&gt;
        frame;&lt;br /&gt;
    Until(key(_esc));&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Function String textinput()&lt;br /&gt;
Private&lt;br /&gt;
    String str;&lt;br /&gt;
    int t;&lt;br /&gt;
    int t2;&lt;br /&gt;
    byte last_ascii;&lt;br /&gt;
    int txtid;&lt;br /&gt;
Begin&lt;br /&gt;
&lt;br /&gt;
    // show what you type in top left corner&lt;br /&gt;
    txtid = write_string(0,0,0,0,&amp;amp;str);&lt;br /&gt;
&lt;br /&gt;
    // clean the string&lt;br /&gt;
    str = &amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    // get input from the user&lt;br /&gt;
    // pressing enter will end the loop&lt;br /&gt;
    Loop&lt;br /&gt;
        if(ascii!=0&amp;amp;&amp;amp;last_ascii==ascii) // check if a key is pressed and if the same key was pressed last frame&lt;br /&gt;
            if(t==0||t&amp;gt;fps/4) // check if the key was just pressed or it has been pressed for 0.25 seconds&lt;br /&gt;
                if(t==0||t2&amp;gt;fps/30) // check if the key was just pressed or it has been pressed for the last 0.03 seconds&lt;br /&gt;
                    t2=0;&lt;br /&gt;
                    switch(ascii) // handle input&lt;br /&gt;
                        case 8: //backspace&lt;br /&gt;
                            str = substr(str,0,len(str)-1);&lt;br /&gt;
                        end&lt;br /&gt;
                        case 13: //enter&lt;br /&gt;
                            break;&lt;br /&gt;
                        end&lt;br /&gt;
                        default: //addkey&lt;br /&gt;
                            str+=chr(ascii);&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
                t2++;&lt;br /&gt;
            end&lt;br /&gt;
            t++;&lt;br /&gt;
        else&lt;br /&gt;
            t = t2 = 0; // reset&lt;br /&gt;
        end&lt;br /&gt;
        last_ascii = ascii;&lt;br /&gt;
        frame;&lt;br /&gt;
    End&lt;br /&gt;
&lt;br /&gt;
    // delete the text used&lt;br /&gt;
    delete_text(txtid);&lt;br /&gt;
&lt;br /&gt;
    // return the typed string&lt;br /&gt;
    return str;&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Used in example: [[set_fps]](), [[say]](), [[write_string]](), [[substr]](), [[chr]](), [[declare]], [[function]], [[switch]], [[ascii]], [[fps]]&lt;br /&gt;
&lt;br /&gt;
You'll find a nice ASCII table [http://www.asciitable.com here].&lt;/div&gt;</description>
			<pubDate>Mon, 28 May 2007 01:46:21 GMT</pubDate>			<dc:creator>Sandman</dc:creator>			<comments>http://fenixwiki.booleansoup.com/index.php/:Textinput</comments>		</item>
	</channel>
</rss>