Game Guide Script Tutorial

*This tutorial was created by optimusconvoy on the original RealmCrafter Standard forums.*

## Part 1

Hello everyone, in this tutorial I'm going to teach you, step by step, how to
make a game guide script. A Game Guide in this case is an NPC who tells
newcommers about the game. I am writing this as code so you can copy>paste,
but for your own good please type it.

So the first thing we need is to
open up script editor, I hope you know how. It should say:

```
Using "RC_Core.rcm"

;

; Date/Time: 5:28:08 PM on 8/23/2010

; By Name
on USER

Function Main()

End Function

```

Now that you have that opened up, you have to make your variables. Variables are
basically subsitutes for commands. For example, Player = Actor(). instead of
typing Actor() you type in Player. So here's what I like to do:

```
Player = Actor() ; you will now type Player

Guide = ContextActor() ; you
will now type guide instead of ContextActor()

```

## Part 2

Now before we do anything else, ever wondered how in games all the NPC's seen to
know your name? here's how it's done. Make a new variable. Type the following:

```
PlayerName$ = Name(Player) ; in the brackets, type the variable you used to
replace Actor(). The $ means "string". that basically means this variable
replaces text, i think

```

Okay so now that we have all that, we need to open the dialog. so right under
your two variables, make a new variable. Choose what you want to use instead of
OpenDialog(Player, Guide,). I will use D.

```
D = OpenDialog(Player, D,)

```

Now we must decide what we want our NPC to say. I want this guy to seem really
wise, so here's what I'll right as the next line:

```
DialogOutput(Player, D, "Hello," $+ PlayerName $+ ". Welcome to the game! What
would you like to know?")

```

## Part 3

There. That's what our NPC, the guide, says. Now of course, our player needs to
choose something to ask about. So we need a DialogInput, aka "Result" or
"Choice". Underneath that line, oh and guess what? It's another variable!:

```
these three for this example, but you can do absolutely whatever you want.

;
and if that dosn't work, after all the choices, try taking the comma away.

;the | is the key right above enter. It's \ shifted.

```

Now you have to do the part where you find out what happens if the player
chooses whichever choice. where I say "Result" you put your variable.

```
If Result = 1 ;If means the same thing it does in Egnlish, If, and 1 means the
first choice in the DialogInput.

     CloseDialog(Player, D,) ;closes the
dialog so we can open up a new one

     D2 = OpenDialog(Player, Guide)
;opens a new dialog. just to keep things fresh.

     DialogOutput(Player,
D2, "here, explain about the first choice. mine is history, so i would talk
about the history of my game.") ;the spacing isn't necesarry but it make scirpts
easier to read.

```

## Part 4

Okay, now if anyone has any questions at all please ask. Now we need to be able
to go back to the other choices. I just figured out how to this today. First we
have to go back to where it says DialogOutput(Player, D, "welcome" $+ PlayerName
$+ "etc"). right ABOVE it, do this:

```
.Back

```

Make sure to put the ".". You don't need to say "Back" just put whatever you
want, but for this tutorial we'll use "Back". Now go back to your first choice.
when the guy's done talking right underneath the dialogoutput command, put this
chunk:

```
Result2 = DialogInput(Player, D2, "Back|Close", "|") ;just like before. now:

     If Result2 = 1

     GoTo(Back)

ElseIf Result2 = 2

 CloseDialog(Player, D2,)

Return

End Function

```

## Part 5

Now just do the excact same thing with all the Results, and I guess that's it. I
hope I helped!

Here's the completed script:

```
Using "RC_Core.rcm"

;

; Date/Time: 5:28:08 PM on 8/23/2010

; By Name
on USER

Function Main()

Player = Actor()

Guide =
ContextActor()

PlayerName$ = Name(Player)

    D = OpenDialog(Player,
Guide,)

    .Back

    DialogOutput(Player, D, "Hello," $+ PlayerName $+
". Welcome to the game! What would you like to know?")

    Result =

If
Result = 1

    CloseDialog(Player, D,)

    D2 = OpenDialog(Player,
Guide,)

    DialogOutput(Player, D2, "blah blah blah")

    Result2 =
DialogInput(Player, D2, "Back|Close", "|")

    If Result2 = 1

GoTo(Back)

    ElseIf Result2 = 2

        CloseDialog(Player, D2)

      Return

ElseIf Result = 2

    CloseDialog(Player, D,)

D3 = OpendDialog(Player, Guide,)

    DialogOutput(Player, D3, "blah blah
blah")

    Result3 = DialogInput(Player, D3, "Back|Close", "|")

    If
Result3 = 1

        GoTo(Back)

    ElseIf Result3 = 2

CloseDialog(Player, D3,)

        Return

ElseIf Result = 3

CloseDialog(Player, D,)

    D4 = OpenDialog(Player, Guide,)

DialogOutput(Player, D4, "blah blah blah")

    Result4 = DialogInput(Player,
D, "Back|Close", "|")

    If Result4 = 1

        GoTo(Back)

    If
Result4 = 2

        CloseDialog(Player, D4,)

        Return

ElseIf Result = 4

    CloseDialog(Player, D,)

    Return

End
Function

```