Skip to content

OSL ‐ Program Flow

Mistium edited this page Jan 8, 2024 · 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 (
  • while condition (commands):

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

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