Skip to content

OSL ‐ Program Flow

Mistium edited this page Dec 1, 2023 · 15 revisions

Main Loop Label:

  • mainloop::
    • This is a label that serves as the entry point for an application's script after the first run cycle. It's where the program starts running after the initial setup.

Conditional Statements (if):

  • if condition (commands):
    • The if statement is used to test a condition. If the condition is true, the code within the block (enclosed in parentheses) is executed.
if condition (
   command
   command
)

---

if condition (
   command
   command
) else (
   command
   command
)

---

if condition "command"

---

if condition "command" else "command"

Looping Constructs (loop):

  • loop number-of-times (commands):

    • The loop statement is used to repeat a block of code a specified number of times.
    • Example: loop number-of-times (
  • until condition (commands):

    • The until statement is used to repeat a block of code until a condition is met.
    • Example: until boolean (

Control Flow (goto and label):

  • goto "label_name":

    • The goto command is used to jump to a specified label within the script.
    • Example: goto "label_name"
  • label_name::

    • The label command defines a label that can be used as a target for the goto command.

Including External Files:

  • import "file_path" or import "file_name" "file_type":
    • The import command is used to run another OSL file's data. You can specify the file by its path or name and type.

Running Commands in a JSON Array:

  • run ["command","command2"]:
    • The run command is used to loop through a JSON array and execute the specified commands inside the array.

originOS Wiki

Wiki Views:
:views

OSL | RSH | ICN

Clone this wiki locally