Tutorials..

Lesson 1 - Who Am I.


Unlike other chats I have used over the years, iP has its own built-in highly powerful script editor/compiler/executor.

Lets change "Program Test;" to "Program HelloWorld;" in the editor.
It is not strictly necessary to change the name of the program within
a iP Script but it is in many full fledged pascal language compilers,
so we will generally follow that rule of thumb in these lessons.

Next we will type our first iP specific command "TALK" (which makes your AV speak).
Talk takes the form "Talk(S : String);"
"S" could be words inside single quotes ex: 'Hi', a string variable, or any combination of both.
So in our first program where we wish to say "hello world" we will use 'Hello World' inside it.

Program HelloWorld;
begin
  TALK('Hello World');
end.

And here is what the result looks like when I press the Execute icon.


MORE:

Now that we can use pascal to talk. Lets build on that with additional commands.

In iP we can send text to the log, using "SendTextToLog" which takes the form:
SendTextToLog(S : String);
Lets edit the TALK('Hello World'); line and replace "Talk" with "SendTextToLog" making our program look like this:

Program HelloWorld;
begin
  SENDTEXTTOLOG('Hello World');
end.

If we look in the log we can see the results of Executing both of our programs:

The "Talk" line above the SendTextToLog shows our name and what we said, like all normal room talk.
But the SendTextToLog line shows only the text we told it to send, SendTextToLog is a handy way to send yourself notices.

"Hello World" is not very exciting, so lets look at a "real world" use of TALK...
Lets say we want to say "Never fear, (our name) is here!" using a script.
To do that we would need to have a way to tell what name we were using at any given time....

"MYName" is the command we use for that in iP...
So now we want to assemble a string containing "Never fear, " and the value of MYName and " is here!"
and then use Talk to make our AV say it... A simple way of doing it would be like this:

Program HelloWorld;
Var
  S : String;
begin
  S:='Never fear, '+MYName+' is here!';
  TALK(S);
end.

We defined a Variable (Var) "S" which is a "String Type" variable.
Then we filled S with 'Never fear, ' plus MYName plus ' is here!'
And here is how it looks in the chat:

Be sure to note the spaces before and after "myname" above.
Leaving out spaces is a common mistake amongst first time scripters.
However it is easy to edit the script and put them in when you notice that they are missing.

Pascal Script Lesson 2.


Pascal Script Lessons..

iP Pascal Script Standard Features.

iP Pascal Script Commands and Functions.

iP Pascal Script Examples.


Tutorials

      

Home