Getting Started

This tutorial shows you how to display a message box in Rhino that says "Hello World". It covers the most basic concepts for editing,  loading and running scripts.

The Complete Script

MsgBox "Hello World"

Test the Script

MsgBox "Hello World"

hello.jpg

The HelloWorld Subroutine

If you were writing a more complex script, and wanted to display "Hello World" at strategic points throughout the script, you could write this code every time you wanted the message to appear.

But if you changed your mind and wanted it to say "Howdy World" instead, you'd have to search for all the places "Hello World" was used, and replace them.

An easier way to solve this problem is to write a Subroutine (Sub for short).  At several places throughout your script, you call the Sub.  The Sub handles displaying the message, so you only have to change the message in one place.

Here's what the subroutine looks like:

Sub HelloWorld()

MsgBox "Hello World"

End Sub

To call this subroutine, simply type:

HelloWorld

Testing HelloWorld

Sub HelloWorld()

MsgBox "Hello World"

End Sub

Nothing happened? That's because the RhinoScript defined the Subroutine but did not actually call it.

Sub HelloWorld()

MsgBox "Hello World"

End Sub

HelloWorld

Saving HelloWorld

When you do more than write a couple lines of script, it becomes necessary to save the script to a file so that you can run the script without typing it every time.

To save your script:

Running HelloWorld.rvb

Your script will run, and display the familiar "Hello World" dialog box.