Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ clean-instances: ### Deletes all room instance data. Starts the world fresh.
run: generate ### Build and run server.
@go run .

.PHONY: run-new
run-new: clean-instances generate run ### Deletes instance data and runs server

.PHONY: run-docker
run-docker: ### Build and run server in docker.
$(DOCKER_COMPOSE) up --build --remove-orphans server
Expand Down
8 changes: 5 additions & 3 deletions _datafiles/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,11 @@ SpecialRooms:
# sending them back into the main world.
DeathRecoveryRoom: 75
# - TutorialStartRooms -
# RoomIds players will be put in when starting the game/tutorial
# RoomIds 900-999 are reserved for Tutorial rooms.
TutorialStartRooms: [900, 910, 920, 930, 940, 990]
# This should be an array of all room id's for the pre-start tutorial.
# The first one on the list is the room they will be placed in when beginning
# Rooms 900-999 are a special range of RoomId's that tell GoMud the user is
# in a tutorial.
TutorialStartRooms: [900, 901, 902, 903]

################################################################################
#
Expand Down
18 changes: 18 additions & 0 deletions _datafiles/guides/building/scripting/FUNCTIONS_ROOMS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Room Specific Functions

- [Room Specific Functions](#room-specific-functions)
- [CreateInstancesFromRoomIds(RoomIds \[int, int...\]) Object ](#createinstancesfromroomidsroomids-int-int-object-)
- [CreateInstancesFromZone(zoneName string) Object ](#createinstancesfromzonezonename-string-object-)
- [GetRoom(roomId int) RoomObject ](#getroomroomid-int-roomobject-)
- [RoomObject.RoomId() int](#roomobjectroomid-int)
- [RoomObject.SendText(msg string\[, excludeUserIds int\])](#roomobjectsendtextmsg-string-excludeuserids-int)
Expand All @@ -27,6 +29,22 @@
- [RoomObject.RepeatSpawnItem(itemId int, roundInterval int \[, containerName\]](#roomobjectrepeatspawnitemitemid-int-roundinterval-int--containername)
- [RoomObject.SetLocked(exitName string, lockIt bool)](#roomobjectsetlockedexitname-string-lockit-bool)

## [CreateInstancesFromRoomIds(RoomIds [int, int...]) Object ](/internal/scripting/room_func.go)
Returns an Object with key/value pairs of `ProvidedRoomId`=>`NewRoomId`
Creates ephemeral instances of the RoomId's provided.

| Argument | Explanation |
| --- | --- |
| RoomIds | an array of integers containing RoomId's you want instanced |

## [CreateInstancesFromZone(zoneName string) Object ](/internal/scripting/room_func.go)
Returns an Object with key/value pairs of `ProvidedRoomId`=>`NewRoomId`
Creates ephemeral instances of the RoomIds of the zone provided.

| Argument | Explanation |
| --- | --- |
| zoneName | The name of the zone to create instances from the zone rooms |

## [GetRoom(roomId int) RoomObject ](/internal/scripting/room_func.go)
Retrieves a RoomObject for a given roomId.

Expand Down
52 changes: 29 additions & 23 deletions _datafiles/world/default/rooms/tutorial/900.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ function onCommand(cmd, rest, user, room) {

teacherMob = getTeacher(room);

var extraDelay = 0;
// Make sure they are only doing stuff that's allowed.

if ( cmd == "east" && !canGoEast ) {
teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area.");
extraDelay = 1.0;
ignoreCommand = true;
}

Expand All @@ -32,17 +34,21 @@ function onCommand(cmd, rest, user, room) {

if ( teach_commands[commandNow] == fullCommand ) {

teacherMob.Command("say Good job!");
teacherMob.Command("say Good job!", 1.0);

if ( cmd == "look orb" ) {
teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.');
extraDelay = 1.0;

if ( fullCommand == "look orb" ) {
teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.', 2.0);
extraDelay = 2.0;
}

if ( cmd == "look east" ) {
teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.');
teacherMob.Command('say Later when you find objects, you can look at them in the same manner.');
teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.');
teacherMob.Command('emote considers for a moment.');
if ( fullCommand == "look east" ) {
teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.', 2.0);
teacherMob.Command('say Later when you find objects, you can look at them in the same manner.', 3.0);
teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.', 4.0);
teacherMob.Command('emote considers for a moment.', 5.0);
extraDelay = 7.0;
}

commandNow++;
Expand All @@ -57,28 +63,28 @@ function onCommand(cmd, rest, user, room) {

switch (commandNow) {
case 0:
teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings');
teacherMob.Command('say type <ansi fg="command">look</ansi> and hit enter to see a description of the area you are in.');
teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings', extraDelay+1.0);
teacherMob.Command('say type <ansi fg="command">look</ansi> and hit enter to see a description of the area you are in.', extraDelay+2.0);
break;
case 1:
teacherMob.Command('say You can also look at creatures or people in the room.');
teacherMob.Command('say type <ansi fg="command">look orb</ansi> to look at me, ' + teacherMob.GetCharacterName(true) + '.');
teacherMob.Command('say You can also look at creatures or people in the room.', extraDelay+1.0);
teacherMob.Command('say type <ansi fg="command">look orb</ansi> to look at me, ' + teacherMob.GetCharacterName(true) + '.', extraDelay+2.0);
break;
case 2:
teacherMob.Command('say Try the <ansi fg="command">look</ansi> command again, but this time, pay attention to any Exits.');
teacherMob.Command('say Try the <ansi fg="command">look</ansi> command again, but this time, pay attention to any <ansi fg="exit">exits</ansi>.', extraDelay+1.0);
break;
case 3:
teacherMob.Command('say Did you notice there is an exit to the <ansi fg="exit">east</ansi>?');
teacherMob.Command('say type <ansi fg="command">look east</ansi> to look into the <ansi fg="exit">east</ansi> room.');
teacherMob.Command('say Did you notice there is an exit to the <ansi fg="exit">east</ansi>?', extraDelay+1.0);
teacherMob.Command('say type <ansi fg="command">look east</ansi> to look into the <ansi fg="exit">east</ansi> room.', extraDelay+2.0);
break;
case 4:
canGoEast = true;
teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.');
teacherMob.Command('say type <ansi fg="command">east</ansi> to travel through the <ansi fg="command">east</ansi> exit.');
teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.', extraDelay+1.0);
teacherMob.Command('say type <ansi fg="command">east</ansi> to travel through the <ansi fg="command">east</ansi> exit.', extraDelay+2.0);
break;
default:
teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.');
teacherMob.Command('say type <ansi fg="command">east</ansi> to travel through the <ansi fg="command">east</ansi> exit.');
teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.', extraDelay+1.0);
teacherMob.Command('say type <ansi fg="command">east</ansi> to travel through the <ansi fg="command">east</ansi> exit.', extraDelay+2.0);
break;
}

Expand All @@ -98,10 +104,10 @@ function onEnter(user, room) {

teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing"));

teacherMob.Command('say Welcome to the Newbie School!');
teacherMob.Command('say I\'ll give you some tips to help you get started.');
teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the <ansi fg="command">look</ansi> command.');
teacherMob.Command('say type <ansi fg="command">look</ansi> and hit enter to see a description of the area you are in.');
teacherMob.Command('say Welcome to the Newbie School!', 1.0);
teacherMob.Command('say I\'ll give you some tips to help you get started.', 2.0);
teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the <ansi fg="command">look</ansi> command.', 3.0);
teacherMob.Command('say type <ansi fg="command">look</ansi> and hit enter to see a description of the area you are in.', 5.0);
}


Expand Down
32 changes: 18 additions & 14 deletions _datafiles/world/default/rooms/tutorial/901.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function onCommand(cmd, rest, user, room) {

teacherMob = getTeacher(room);

var extraDelay = 0;
// Make sure they are only doing stuff that's allowed.

if ( cmd == "south" && !canGoSouth ) {
Expand All @@ -33,16 +34,19 @@ function onCommand(cmd, rest, user, room) {

if ( teach_commands[commandNow] == fullCommand ) {

teacherMob.Command("say Good job!");
teacherMob.Command("say Good job!", 1.0);
extraDelay = 1.0;

if ( cmd == "status" ) {
teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.');
teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.');
teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.', 2.0);
teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.', 3.0);
extraDelay = 3.0;
}

if ( cmd == "inventory" ) {
teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.');
teacherMob.Command('say Remember, you can <ansi fg="command">look</ansi> at stuff you\'re carrying any time you want.');
teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.', 2.0);
teacherMob.Command('say Remember, you can <ansi fg="command">look</ansi> at stuff you\'re carrying any time you want.', 3.0);
extraDelay = 3.0;
}

commandNow++;
Expand All @@ -63,24 +67,24 @@ function onCommand(cmd, rest, user, room) {
user.GiveItem(itm);
}

teacherMob.Command('say To see all of your characters stats, type <ansi fg="command">status</ansi>.');
teacherMob.Command('say To see all of your characters stats, type <ansi fg="command">status</ansi>.', extraDelay+1.0);
break;
case 1:
teacherMob.Command('say To only peek at your inventory, type <ansi fg="command">inventory</ansi>.');
teacherMob.Command('say To only peek at your inventory, type <ansi fg="command">inventory</ansi>.', extraDelay+1.0);
break;
case 2:
teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".');
teacherMob.Command('say For quick look at your progress, type <ansi fg="command">experience</ansi>.');
teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".', extraDelay+1.0);
teacherMob.Command('say For quick look at your progress, type <ansi fg="command">experience</ansi>.', extraDelay+2.0);
break;
case 3:
teacherMob.Command('emote touches you and you feel more focused.');
user.GiveBuff(32, "training");
teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.');
teacherMob.Command('say type <ansi fg="command">conditions</ansi> to see any statuses affecting you.');
teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.',extraDelay+1.0);
teacherMob.Command('say type <ansi fg="command">conditions</ansi> to see any statuses affecting you.', extraDelay+2.0);
break;
case 4:
user.GiveBuff(-32, "training");
teacherMob.Command('say head <ansi fg="command">south</ansi> for the next lesson.');
teacherMob.Command('say head <ansi fg="command">south</ansi> for the next lesson.', extraDelay+1.0);
canGoSouth = true;
room.SetLocked("south", false);
break;
Expand All @@ -105,8 +109,8 @@ function onEnter(user, room) {

teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing"));

teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.');
teacherMob.Command('say To get a detailed view of a LOT of information all at once, type <ansi fg="command">status</ansi> and hit enter.');
teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.', 1.0);
teacherMob.Command('say To get a detailed view of a LOT of information all at once, type <ansi fg="command">status</ansi> and hit enter.', 2.0);
}


Expand Down
23 changes: 14 additions & 9 deletions _datafiles/world/default/rooms/tutorial/902.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function onCommand(cmd, rest, user, room) {

teacherMob = getTeacher(room);

var extraDelay = 0;
// Make sure they are only doing stuff that's allowed.

if ( cmd == "south" && !canGoSouth ) {
Expand All @@ -31,15 +32,19 @@ function onCommand(cmd, rest, user, room) {

if ( teach_commands[commandNow] == fullCommand ) {

teacherMob.Command("say Good job!");
teacherMob.Command("say Good job!", 1.0);

extraDelay = 1.0;

if ( cmd == "equip stick" ) {
teacherMob.Command('say Check it out! If you type <ansi fg="command">status</ansi> you\'ll see the stick is equipped!');
teacherMob.Command('say Check it out! If you type <ansi fg="command">status</ansi> you\'ll see the stick is equipped!', 2.0);
extraDelay = 2.0;
}

if ( cmd == "inventory" ) {
teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.');
teacherMob.Command('say Remember, you can <ansi fg="command">look</ansi> at stuff you\'re carrying any time you want.');
teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.', 2.0);
teacherMob.Command('say Remember, you can <ansi fg="command">look</ansi> at stuff you\'re carrying any time you want.', 3.0);
extraDelay = 3.0;
}

commandNow++;
Expand All @@ -65,14 +70,14 @@ function onCommand(cmd, rest, user, room) {
user.GiveItem(itm);
}

teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type <ansi fg="command">equip stick</ansi>.');
teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type <ansi fg="command">equip stick</ansi>.', extraDelay+1.0);
break;
case 1:

getDummy(room);

teacherMob.Command('say You may have noticed the <ansi fg="mobname">training dummy</ansi> here.');
teacherMob.Command('say Go ahead and engage in combat by typing <ansi fg="command">attack dummy</ansi>.');
teacherMob.Command('say You may have noticed the <ansi fg="mobname">training dummy</ansi> here.', extraDelay+1.0);
teacherMob.Command('say Go ahead and engage in combat by typing <ansi fg="command">attack dummy</ansi>.', extraDelay+2.0);
break;
case 2:
// teacherMob.Command('say Head <ansi fg="exit">west</ansi> to complete your training.');
Expand All @@ -98,14 +103,14 @@ function onEnter(user, room) {

teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing"));

teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!');
teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!', 1.0);

if ( !user.HasItemId(firstItemId) ) {
itm = CreateItem(firstItemId);
user.GiveItem(itm);
}

teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type <ansi fg="command">equip stick</ansi>.');
teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type <ansi fg="command">equip stick</ansi>.', 2.0);
}


Expand Down
Loading
Loading