Skip to content

Commit 319d5f3

Browse files
committed
Fixing tutorial script, fixing guide spawn logic
1 parent ab76a6a commit 319d5f3

File tree

3 files changed

+32
-36
lines changed

3 files changed

+32
-36
lines changed

_datafiles/world/default/rooms/tutorial/901.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,7 @@ function onCommand(cmd, rest, user, room) {
5757

5858
switch (commandNow) {
5959
case 0:
60-
61-
if ( !user.HasItemId(firstItemId) ) {
62-
itm = CreateItem(firstItemId);
63-
user.GiveItem(itm);
64-
}
65-
60+
6661
teacherMob.Command('say To see all of your characters stats, type <ansi fg="command">status</ansi>.', 1.0);
6762
break;
6863
case 1:
@@ -101,6 +96,12 @@ function onCommand(cmd, rest, user, room) {
10196
function onEnter(user, room) {
10297
room.SetLocked("west", true);
10398

99+
100+
if ( !user.HasItemId(firstItemId) ) {
101+
itm = CreateItem(firstItemId);
102+
user.GiveItem(itm);
103+
}
104+
104105
sendWorkingCommands(user);
105106

106107
teacherMob = getTeacher(room);

_datafiles/world/empty/rooms/tutorial/901.js

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function onCommand(cmd, rest, user, room) {
1919

2020
teacherMob = getTeacher(room);
2121

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

2524
if ( cmd == "south" && !canGoSouth ) {
@@ -35,18 +34,15 @@ function onCommand(cmd, rest, user, room) {
3534
if ( teach_commands[commandNow] == fullCommand ) {
3635

3736
teacherMob.Command("say Good job!", 1.0);
38-
extraDelay = 1.0;
3937

4038
if ( cmd == "status" ) {
41-
teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.', 2.0);
42-
teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.', 3.0);
43-
extraDelay = 3.0;
39+
teacherMob.Command('say You can see how much <ansi fg="yellow">Gold</ansi> you carry, your <ansi fg="yellow">Level</ansi>, and even attributes like <ansi fg="yellow">Strength</ansi> and <ansi fg="yellow">Smarts</ansi>.', 1.0);
40+
teacherMob.Command('say It\'s a lot of information, but you\'ll quickly learn to only pay attention to the important stuff.', 1.0);
4441
}
4542

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

5248
commandNow++;
@@ -61,30 +57,27 @@ function onCommand(cmd, rest, user, room) {
6157

6258
switch (commandNow) {
6359
case 0:
64-
65-
if ( !user.HasItemId(firstItemId) ) {
66-
itm = CreateItem(firstItemId);
67-
user.GiveItem(itm);
68-
}
69-
70-
teacherMob.Command('say To see all of your characters stats, type <ansi fg="command">status</ansi>.', extraDelay+1.0);
60+
61+
teacherMob.Command('say To see all of your characters stats, type <ansi fg="command">status</ansi>.', 1.0);
7162
break;
7263
case 1:
73-
teacherMob.Command('say To only peek at your inventory, type <ansi fg="command">inventory</ansi>.', extraDelay+1.0);
64+
teacherMob.Command('say To only peek at your inventory, type <ansi fg="command">inventory</ansi>.', 1.0);
7465
break;
7566
case 2:
76-
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);
77-
teacherMob.Command('say For quick look at your progress, type <ansi fg="command">experience</ansi>.', extraDelay+2.0);
67+
teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".', 1.0);
68+
teacherMob.Command('say For quick look at your progress, type <ansi fg="command">experience</ansi>.', 1.0);
7869
break;
7970
case 3:
8071
teacherMob.Command('emote touches you and you feel more focused.');
8172
user.GiveBuff(32, "training");
82-
teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.',extraDelay+1.0);
83-
teacherMob.Command('say type <ansi fg="command">conditions</ansi> to see any statuses affecting you.', extraDelay+2.0);
73+
teacherMob.Command('noop', 2);
74+
teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects (and sometimes both!).',1.0);
75+
teacherMob.Command('say type <ansi fg="command">conditions</ansi> to see any statuses affecting you.', 1.0);
8476
break;
8577
case 4:
8678
user.GiveBuff(-32, "training");
87-
teacherMob.Command('say head <ansi fg="command">south</ansi> for the next lesson.', extraDelay+1.0);
79+
teacherMob.Command('say Some special conditions might last indefinitely, such as natural abilities like night vision. Others may expire after enough time passes.', 1.0);
80+
teacherMob.Command('say head <ansi fg="command">south</ansi> for the next lesson.', 1.0);
8881
canGoSouth = true;
8982
room.SetLocked("south", false);
9083
break;
@@ -103,29 +96,30 @@ function onCommand(cmd, rest, user, room) {
10396
function onEnter(user, room) {
10497
room.SetLocked("west", true);
10598

99+
100+
if ( !user.HasItemId(firstItemId) ) {
101+
itm = CreateItem(firstItemId);
102+
user.GiveItem(itm);
103+
}
104+
106105
sendWorkingCommands(user);
107106

108107
teacherMob = getTeacher(room);
109108

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

112111
teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.', 1.0);
113-
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);
114-
112+
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.', 1.0);
115113
return true;
116114
}
117115

118-
119-
120116
function onExit(user , room) {
121117
// Destroy the guide (cleanup)
122118
destroyTeacher(room);
123119
canGoSouth = false;
124120
commandNow = 0;
125121
}
126122

127-
128-
129123
function onLoad(room) {
130124
canGoSouth = false;
131125
commandNow = 0;
@@ -134,6 +128,7 @@ function onLoad(room) {
134128
function getTeacher(room) {
135129
var mobActor = room.GetMob(teacherMobId, true);
136130
mobActor.SetCharacterName(teacherName);
131+
137132
return mobActor;
138133
}
139134

internal/hooks/RoomChange_SpawnGuide.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ func SpawnGuide(e events.Event) events.ListenerReturn {
3838
}
3939

4040
fromRoomOriginal := rooms.GetOriginalRoom(evt.FromRoomId)
41-
if fromRoomOriginal >= 900 || fromRoomOriginal <= 999 {
41+
if fromRoomOriginal >= 900 && fromRoomOriginal <= 999 {
4242
return events.Continue
4343
}
4444

45-
toRoomOriginal := rooms.GetOriginalRoom(evt.FromRoomId)
46-
if toRoomOriginal >= 900 || toRoomOriginal <= 999 {
45+
toRoomOriginal := rooms.GetOriginalRoom(evt.ToRoomId)
46+
if toRoomOriginal >= 900 && toRoomOriginal <= 999 {
4747
return events.Continue
4848
}
4949

0 commit comments

Comments
 (0)