Normally when you want to use a script in a room you must put that script in a spot in that room. However, it is possible to make a script so that it can be more easily used in multiple rooms. To do this you define the script by giving it a name and declaring it as GLOBAL. Having once seen the script in one room you can now use it in other rooms (or Handlers within the same room) by refering to it by name.
Here's how you'd do that with <your script>:
Define the script in a Handler (ON ENTER, ON INCHAT, ON OUTCHAT, etc.) you know your guests will execute before the script is needed in another Handler in the same room or in another room. This is typically done as an ON SIGNON script at your gate or an ON ENTER script in a room although it could be any Handler:
ON SIGNON {
your_script_name GLOBAL
{ <your script> } your_script_name DEF
}
Place the following script in each Handler in each room where you want your script to execute:
your_script_name GLOBAL
your_script_name EXEC
It's as simple as that.
An added benefit of this approach is that you can change how the script works in all related rooms by changing the script once at its source.
As an example, let's use a simple script that greets a person when they enter a room:
"Hi, " USERNAME & ", welcome to the " & ROOMNAME & " room." & LOCALMSG
The first thing we do is define it. In this example it is defined in an ON SIGNON script for the gate:
ON SIGNON {
roomgreet GLOBAL
{ "Hi, " USERNAME & ", welcome to the " & ROOMNAME & " room." & LOCALMSG } roomgreet DEF
}
Then, in every room where we want this script we put:
ON ENTER {
roomgreet GLOBAL
roomgreet EXEC
}
Even though in this example we haven't saved much work in all rooms it would have if the script had been more complicated.