<html><!-- #BeginTemplate "/Templates/BookLayout.dwt" --><!-- DW6 -->
<head>
<!-- #BeginEditable "doctitle" --> 
<title>What is Iptscrae?</title>
<!-- #EndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.sheet1 {  font-family: Arial, Helvetica, sans-serif; clip:     rect(   ); text-indent: 10pt}
.header {  font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: bold; clip:   rect(   )}
.code {  font-family: "Courier New", Courier, mono; padding-left: 20px}
.list {  font-family: Verdana, Arial, Helvetica, sans-serif}
.command {  font-weight: bold; font-family: "Courier New", Courier, mono; text-transform: uppercase}
-->
</style>
</head>

<body bgcolor="#FFFFFF" class="sheet1">
<!-- #BeginEditable "Header" --> 
<p class="header">What is Iptscrae?</p>
<!-- #EndEditable --> 
<table width="100%" border="0" height="25">
  <tr> 
    <td width="33%"><!-- #BeginEditable "Previous Page" --><a href="whatisscripting.html">What 
      is Scripting?</a><!-- #EndEditable --></td>
    <td> 
      <div align="center"><!-- #BeginLibraryItem "/Library/TOC Link.lbi" --><a href="../index.html">Table of Contents</a><!-- #EndLibraryItem --></div>
    </td>
    <td> 
      <div align="right"><!-- #BeginEditable "Next Page" --><a href="typesofarguments.html">Types 
        of Arguments</a><!-- #EndEditable --></div>
    </td>
  </tr>
</table>
<hr>
<!-- #BeginEditable "Body" --> 
<p>Iptscrae is the scripting language that Palace uses. The name comes from the 
  pig latin for script. Iptscrae is what we computer geeks like to call a Reverse 
  Polish Notation, or postfix language. The <!-- #BeginLibraryItem "/Library/Iptscrae Command Reference.lbi" --><a href="http://www.thepalace.com/help/manuals/iptscrae/Output/iptscraeTOC.html">Iptscrae 
Command Reference</a><!-- #EndLibraryItem --> talks about this to some detail. 
  In a nutshell, iptscrae does things in reverse order than that of other scripting 
  languages.</p>
<p>Remember how we talked about arguments and commands earlier? In iptscrae, you 
  tell the language about the argument first, then give it the command. This is 
  similar to telling your child &quot;yard clean&quot; or &quot;room clean&quot; 
  For people who have scripted or programmed before, this takes some getting used 
  to!</p>
<p>There are many technical reasons why iptscrae works this way. The one you as 
  a scripter are concerned with is that of iptscrae's stack. Think of a stack 
  as a pile of dishes. With me so far? Lets say you have three dishes, a <font color="#FF0000">red</font> 
  one, a <font color="#00FF00">green</font> one and a <font color="#0000FF">blue</font> 
  one. Using our clean analogy before, how would you clean the green plate? <font color="#00FF00">green</font> 
  clean would be the answer. Some commands take several arguments though. How 
  do we handle this case? Lets say we had a command named cleanthese, that cleaned 
  all of the dishes you handed it.</p>
<p>Well the stack is like a pile of dishes. Lets say we take the <font color="#FF0000">red</font> 
  dish and set it on the counter:</p>
<p><font color="#FF0000">red</font></p>
<p>Now lets say we set the blue plate on top of it:</p>
<p><font color="#0000FF">blue</font></p>
<p><font color="#FF0000">red</font></p>
<p>Now we have a pile of two dishes! If we now said &quot;clean&quot; then iptscrae 
  would clean the blue dish, because its the top one on the stack. Iptscrae washes 
  dishes just like you would! After that dish is washed and put away, we only 
  have the <font color="#FF0000">red</font> dish left. Telling iptscrae to &quot;clean&quot; 
  again would then clean the red dish. What happens if we tell iptscrae to clean 
  a third time? With the new Palace client, we will get an error, because there 
  is nothing left to clean.</p>
<p>Now for some technical terms. Putting something onto the stack is called &quot;pushing.&quot; 
  Taking something off of the stack is called &quot;popping.&quot; Iptscrae commands 
  always work by popping their arguments off of the stack. Some commands require 
  no arguments, some require one argument, some commands require several arguments.</p>
<p>Some commands even push their own data onto the stack! Lets look at our first 
  real example, using the addition command, or + sign:</p>
<p>10 5 <span class="command">+</span></p>
<p>In this little bit of iptscrae, we first push the number 10 onto the stack. 
  Then we push the number 5 onto the stack. Then we execute the addition command. 
  Before the addition command executes, the stack looks like this:</p>
<p>5</p>
<p>10</p>
<p>After the addition command executes, the stack looks like this:</p>
<p>15</p>
<p>Whoa! What happened here? The addition command first pops off the 5. It next 
  pops off the 10. Remember, popping off an argument is like taking a dish off 
  the top of the dish stack to wash it, and you never put a clean plate back on 
  a dirty pile! Now that addition has the two numbers it needs, it adds them up, 
  gets the result of 15, then pushes that 15 back onto the stack.</p>
<p>Why does addition push the 15 onto the stack? This is done so you can use the 
  result of the addition. You might store this result for later use, or you might 
  use it immediately in a new command. Lets get a bit more complicated and see 
  if you are still with us:</p>
<p>10 5 + 2 <span class="command">*</span></p>
<p>Jumping Jimmy! Whats that nonsense? Well its all rather simple if you just 
  keep the dish stack concept in memory. First, 10 is pushed onto the stack, then 
  5 as before. Addition takes those two numbers off the stack (so we're out of 
  dishes at the moment) and adds them. It then pushes the result, 15, onto the 
  stack. Next we see a 2, which means to push it on the stack, so our stack now 
  looks like:</p>
<p>2</p>
<p>15</p>
<p>Finally, we see the multiplication command, which indeed takes two arguments. 
  It pops off the 2, then the 15, multiplies them, then pushes the result, 30, 
  back onto the stack!</p>
<p>See how this all works? You push arguments that commands you want to use onto 
  the stack, simply by declaring the value, such as 2. You then declare the command 
  and it executes. All you need to know is what command you want to use and what 
  arguments that command expects to see on the stack.</p>
<p>How big is this stack of dishes you ask? It can get fairly large, but its a 
  wise idea to try and keep the stack small. As the stack grows it does require 
  more of the computers memory to keep track of whats in that stack, so use it 
  wisely.</p>
<p>Next we will talk about the different kind of arguments, or dishes, we can 
  have on the stack.</p>
<!-- #EndEditable --> 
<hr>
<table width="100%" border="0" height="25">
  <tr> 
    <td width="33%"><!-- #BeginEditable "Previous Page 2" --><a href="whatisscripting.html">What 
      is Scripting?</a><!-- #EndEditable --></td>
    <td> 
      <div align="center"><!-- #BeginLibraryItem "/Library/TOC Link.lbi" --><a href="../index.html">Table of Contents</a><!-- #EndLibraryItem --></div>
    </td>
    <td> 
      <div align="right"><!-- #BeginEditable "Next Page 2" --><a href="typesofarguments.html">Types 
        of Arguments</a><!-- #EndEditable --></div>
    </td>
  </tr>
</table>
<p align="center"><i>Last Updated on <!-- #BeginEditable "TheDate" --><i>03/08/2000</i><!-- #EndEditable --></i>
</body>
<!-- #EndTemplate --></html>
