COMMAND is one of the most common and useful scripting events in Odyssey. This template gives a generally accepted method for laying down the skeleton of COMMAND, making adding both mortal commands and god commands easier.
Function Main(Player as Long, Command as String, Parm1 as String, Parm2 as String, Parm3 as String) as Long
Dim Target as Long
Dim i as Long
Main = Stop
Target = Val(Parm1)
If Target = 0 Then
For i = 0 To GetMaxUsers()
If StrCmp(Mid(Parm1, 1, Len(Parm1)), Mid(GetPlayerName(i), 1, Len(Parm1))) & IsPlaying(i) Then Target = i
Next i
End If
If StrCmp(Parm1, "") Then Target = 0
If StrCmp(Parm1, "self") | StrCmp(Parm1, "me") | StrCmp(Parm1, "myself") Then Target = Player
Select Case Command
'''Insert mortal commands here
Case Else
If GetPlayerAccess(Player) Then
Select Case Command
'''Insert god commands here
Case "run"
RunScript0(Parm1)
Case Else
Main = Continue
End Select
Else
Main = Continue
End If
End Select
End Function