scottkit 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -80,7 +80,15 @@ STILL TO DO
80
80
 
81
81
  CHANGES
82
82
 
83
- 0.1.0 Add -p option to compile and play a game from source.
83
+ Release 0.2.0
84
+ - Add -z option to sleep after finishing -- useful when
85
+ running in a DOS Shell under Windows, so that error messages
86
+ can be seen.
87
+ - Add facility to load a game while playing using "#load"
84
88
 
85
- 0.0.0 Initial release.
89
+ Release 0.1.0
90
+ - Add -p option to compile and play a game from source.
91
+
92
+ Release 0.0.0
93
+ - Initial release.
86
94
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/bin/scottkit CHANGED
@@ -32,6 +32,8 @@ end
32
32
  mode = :play
33
33
  options = {}
34
34
  compile, decompile, play_from_source = false, false, false
35
+ sleep_at_end = false
36
+
35
37
  opts = OptionParser.new do |x|
36
38
  x.banner = "Usage: #$0 [options] [<data-file>]"
37
39
  x.on("-c", "--compile", "Compile <data-file> instead of loading") {
@@ -61,6 +63,9 @@ opts = OptionParser.new do |x|
61
63
  x.on("-b", "--bug-tolerant", "Copy with out-of-range locations, etc.") {
62
64
  options[:bug_tolerant] = true
63
65
  }
66
+ x.on("-z", "--sleep-at-end", "Sleep for a long time after program ends") {
67
+ sleep_at_end = true
68
+ }
64
69
  x.on("-W", "--no-wait", "Do not wait on pause actions or death") {
65
70
  options[:no_wait] = true
66
71
  }
@@ -89,6 +94,7 @@ rescue
89
94
  exit 1
90
95
  end
91
96
 
97
+ exitval = 0
92
98
  game = ScottKit::Game.new(options)
93
99
  case mode
94
100
  when :play_from_source
@@ -96,15 +102,17 @@ when :play_from_source
96
102
  withIO(nil, f) do
97
103
  if !game.compile_to_stdout(ARGV[0])
98
104
  $stderr.puts "#$0: compilation failed: not playing"
99
- exit 1
105
+ exitval = 1
100
106
  end
101
107
  end
102
- game.load(f.string)
103
- play(game)
108
+ if exitval == 0
109
+ game.load(f.string)
110
+ play(game)
111
+ end
104
112
  when :compile
105
113
  if !game.compile_to_stdout(ARGV[0])
106
114
  $stderr.puts "#$0: compilation failed"
107
- exit 1
115
+ exitval = 1
108
116
  end
109
117
  when :decompile
110
118
  game.load(IO.read(ARGV[0]))
@@ -115,3 +123,8 @@ when :play
115
123
  game.load(IO.read(ARGV[0]))
116
124
  play(game)
117
125
  end
126
+
127
+ if sleep_at_end
128
+ sleep 9999
129
+ end
130
+ exit exitval
@@ -178,3 +178,4 @@ action score: score
178
178
  action look: look
179
179
  action inventory: inventory
180
180
  action save game: save_game
181
+ action quit: game_over
data/lib/scottkit/play.rb CHANGED
@@ -96,6 +96,10 @@ module ScottKit
96
96
  return
97
97
  end
98
98
  end
99
+ if verb.upcase == "#LOAD"
100
+ restore(noun)
101
+ return
102
+ end
99
103
 
100
104
  verb = "inventory" if verb == "i"
101
105
  verb = "look" if verb == "l"
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mike Taylor