Making Scripts with RPNEnh


Introduction

RPNEnh Scripting System allow you to makes scripts, you can use any functions from RPNenh in your scripts.
There are no limitation.
scripts are usually stored into files.
You access scripts in the VAR menu.

See also : Programs. I strongly advise to use program instead of scripts, their conception is more modern and strong. (note : programs are based on script internaly)

Methods

That may look strange, but you have two methods for building Scripts.
The "Quick List Entry" method
  •  +  Easy to use
  •  +  No problem with syntax (relax)
  •  -  Once the Script is done, you cannot modify it easily. there are some workaround...
  • The "String Source" method
  •  +  Can change script easily
  •  -  Syntax more strict
  •  -  You must understand RPNE Structure to be able to maintain scripts
  •  +  you can work directly with file
  •  +  you can place some comment in the file (#)
  • You can choose any of these two method, if you are a beginer, I advise you to choose the Quick List Entry method.

    Introduction to Quick List Entry

    With this method you will enter your RPN command into a list.
    Follow this case study :
    hit { to start building a list.
    type here your program.

    The script is 5 DUP 3 + 2 ->List

    What does do that script in fact ?
    hit OK,
    now you have the list on the stack.
    You must use List->Script to convert this list into StringSource

    Hit the TAB key of your keyboard and search for List->Script.
    Now, you have a string on the stack : this is the StringSource
    please note that you cannot revert this string into the list ! that's the only negative aspect of this method. as a workaround, you can DUP the list before using List->Script.
    We will now save this script (string) into VAR

    You must choose a name and use STOScript.
    The name here is "abc".

    NOTE : don't use STO to save,
    STO will save as a STRING. STOScript will save a SCRIPT.
    Ok, it's done,
    take a look at the VAR menu, you will see a new function : abc
    That's all
    Basicaly, you can now create your own scripts.


    String Source Method

    The goal of this method is to work directly with the string.
    Once you udnerstood how it's work you can modify directly the file where is stored your script.
    You can start making your scripts with the Quick List Entry method and modify them afterward by using notepad to open the file.
    please follow this link to learn everything about this method.
    Please check script overview to understand difference between QLE and StringSource.

    Script Specific functions

    Here are function you may use in your scripts.
    function note example
    input request for input from user,
    script is halted and waiting for user to
    enter something or use cancel button
    "information text" display this text in dialogbox
    { "info txt" default-value }
    for example : { "enter you name" "bob"}
    other example : {"1+1=?" 3 }
    FOR
    ...
    NEXT
    can be used only in script

    perform a loop.
    theFORtakes two values from the stack
    The current index is given by INDEX
    You can nest many loops
    this is a script in QLE method :
    { 1 10 FOR
    INDEX
    NEXT
    }
    note : See documentation about program to learn details about FOR..NEXT or IF..THEN..ELSE..ENDIF