First Page       Alias Help      Popups Help       Unix Reference      Web Promotion      WWW Help Links
Contact me!!
PIL BASICS

In this we will learn a little about Pirch's powerful scriptining language, PIL, which stands for Pirch Intrepreted Language. We will atemp to help you understand the language a litlle better than the help manual for Pirch does. Today i will break down a small PIL that i made when i first strated to write scripts in PIL.The PIL is called bluehart.pil

But first a few basics to help you with learning about PIL scripts

Add PIL Script           Loads a PIL script from a text file and installs it into the alias window

To load (add) a PIL script you can do it a couple ways as listid below

/ADDPIL
Usage:   /addpil <drive:\path\script.pil>
Example: /addpil c:\pirch32\bluehart.pil

by typing in the above it will load the named script into your alias file, in this case you are loading the the file bluehart.pil that is located in the directory c:\pirch32 into your alias file

the other way to load a PIL script is by opening your alias file from the alias button on toolbar or by holding the  (cntrl+alt+A)
keys. This will bring up the Aliases window where you cna right click in the alias name section then you will get a small menu.
You can then select the ADD PIL SCRIPT and select the file to load. After you load the script you will have to click the save button

OK, now that you know how to load a script, lets start with the making of a PIL.

Step 1)   Open the aliases and click the add button and in the name box type [bluehart]   (use the brackets to identify it as a
             PIL and not an alias) then you will have an empty PIL in your editor.
Step 2)  Begin to make your pil, in this case the bluehart pil which what we want it to do is to add a blue heart in between each
             letter that we type as a message

      A)  I like to add all comments on the usage and version of my PILS to the begining of each PIL i make (see below)
 
            {
            this is my bluehart pil
            useage
            popup      bluehart:/runscript [bluehart] $?="message"
            alias         bluehart:/runscript [bluehart] *1
            ---------------------------------------------------------------------------------
            need help find me here
            Contact me on kaustubhuc@hotmail
            ----------------------------------------------------------------------------------
            Kaustubh
            }
 
      B)  Next lets begin to add the first lines of code

           $output :='';
                    { this makes sure that the variable is set to null or no value }
           $source := *1 ;
                   { this is the string of the whole message you will type in }
           $add := '13©';
                   { this is the heart that will be inserted into the text }
                   {the characters are as follows ( cntrl S + cntrl K + 13 + alt 0169 + cntrl S ) }

        C)  Now the next line of the code is

           for i := 1 to strlen($source) do
                  { this sets up a loop from the first character to the last (strlen),
                     to how many letters there will be in the total message}
                 
        D)  The next line of the code is
 
            begin
                   { this sets the loop in motion}

        E)  The next line of the code is

            $letter := '12'+strupper(strcopy($source,i,1));
                   {here is where we get each individual letter,with the strcopy it will
                     pick each letter ($source,i,1) pulls the specific location ( i ) and then only pulls 1 letter ( 1) )

        F)  The next line of the code is

           $output := $output+$letter+$add;
                   { here is where we place the text ($letter) with the character we will be using
                      in this case its he blue heart ($add) }

        G)  The next line of the code is

            end;
                   { end of the current procedure}

        H)  The next line of the code is

           command('/msg ',$audience,' ',$output);
                  { here is where the text is resent to the channel by messaging the
                     channel ($audience) with the message ($output) }

OK now you have just made a pil :o).click save now. hopefully this will help you to learn a little more than you knew when you started this lesson.for the whole PIL see below

            {
            this is my bluehart pil
            useage
            popup      bluehart:/runscript [bluehart] $?="message"
            alias         bluehart:/runscript [bluehart] *1
            ---------------------------------------------------------------------------------
            need help find me here
            #pirch-popups                  us.undernet.org:6667
            #pirch / #chatcircuit        irc.chatcircuit.com:6667
            ----------------------------------------------------------------------------------
            budman
            }
           $output :='';
           $source := *1 ;
           $add := '13©';
            for i := 1 to strlen($source) do
           begin
           $letter := '12'+strupper(strcopy($source,i,1));
           $output := $output+$letter+$add;
           end;
           command('/msg ',$audience,' ',$output);

         Ok, now you have this pil you made, you probably are asking how do i run it, well thats pretty easy you can use either of
         the above  popups or alias to run it

            popup       bluehart:/runscript [bluehart] $?="message"
            alias         bluehart:/runscript [bluehart] *1
 
 

        Well that about covers this lesson on writting a PIL with PIL BASICS by Kaustubh Chokshi
please also visit Kausutbh's Pirch Popups