GameGrid 0.9.5.2.8 → 0.9.5.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gamegrid.rb +817 -6
- data/lib/GameGrid.rb +0 -1
- data/lib/install.rb +0 -79
- data/lib/main.rb +0 -819
- data/lib/plgvaldb.rb +0 -5
- data/lib/sh.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f241f6876f31a923c23223f18447e7b2a5a5ea82
|
4
|
+
data.tar.gz: 373636c2ce372e4965ce1bb6c0ad1a647fb5df4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50f9673e5d053c6ca273405550b575c801d11f4f8fe4c5fdfc6e5879c1f59dc7736bc7900b96ded356d233936fe6c780d34ca219879ee01668b7b9bceae70a8f
|
7
|
+
data.tar.gz: 051458e274c1cfc2cb5364356da0f60d756e9f7e9c69acc720c5cd4444ce4b5265b7dc259a5bfbd122f31ba096aea24ae2111f8c0ce8fe4bd4a4d36c2e193d2f
|
data/bin/gamegrid.rb
CHANGED
@@ -1,8 +1,819 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
#=============================GameGrid, an in-console game===========================#
|
2
|
+
|
3
|
+
|
4
|
+
#DEVELOPERS: The Console Object
|
5
|
+
|
6
|
+
$console={
|
7
|
+
:log=>"Console/Log:",
|
8
|
+
:errors=>"Error Log:"
|
9
|
+
}
|
10
|
+
#Console Functions
|
11
|
+
def log(msg)
|
12
|
+
$console[:log]+=Time.now.to_s+": "+msg;
|
13
|
+
end
|
14
|
+
def error(msg, errorType=StandardError)
|
15
|
+
log("ERROR - "+msg+" ET: "+errortype.name)
|
16
|
+
$console[:errors]+="\n"+msg;
|
17
|
+
raise errorType, msg
|
18
|
+
end
|
19
|
+
def errorA(msg)
|
20
|
+
error(msg,ArgumentError)
|
21
|
+
end
|
22
|
+
def checkA(arg,expclass)
|
23
|
+
errorA("Argument '#{arg}' is not a #{exptype}.") unless arg.is_a?( expclass);
|
24
|
+
log("Checking arguments using checkA method... input:#{arg} expected type:#{expclass}")
|
25
|
+
end
|
26
|
+
# Now using Begin/Rescue commands to fix IP issues
|
27
|
+
$platsur="cp";
|
28
|
+
begin
|
29
|
+
if ($platsur==="cp") then
|
30
|
+
require 'socket'
|
31
|
+
$ip_gateway=Socket::getaddrinfo(Socket.gethostname,"echo",Socket::AF_INET)
|
32
|
+
$ip_socket=$ip_gateway[0]
|
33
|
+
$ip=$ip_socket[3]
|
34
|
+
elsif ($platsur.index("browser")!=nil) then
|
35
|
+
$ip="192.168.1.1" #< This is your router ip, always
|
36
|
+
else
|
37
|
+
$ip="64.233.187.99" #< This is one of Google's IP Pool
|
38
|
+
end
|
39
|
+
#Track the client OS
|
40
|
+
def onWindows?
|
41
|
+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def onMac?
|
45
|
+
(/darwin/ =~ RUBY_PLATFORM) != nil
|
46
|
+
end
|
47
|
+
|
48
|
+
def onUnix?
|
49
|
+
!onWindows?
|
50
|
+
end
|
51
|
+
|
52
|
+
def onLinux?
|
53
|
+
onUnix? and not onMac?
|
54
|
+
end
|
55
|
+
|
56
|
+
def onOtherOS?
|
57
|
+
!onWindows?&&!onMac?&&!onLinux?&&!onUnix?
|
58
|
+
end
|
59
|
+
|
60
|
+
def getplatform
|
61
|
+
plat="other"
|
62
|
+
plat="windows" if onWindows?;
|
63
|
+
plat="mac" if onMac?;
|
64
|
+
#plat="unix" if onUnix?;
|
65
|
+
plat="linux" if onLinux?
|
66
|
+
plat="unix" if plat==="other"&&onUnix?
|
67
|
+
return plat
|
68
|
+
end
|
69
|
+
|
70
|
+
def getplat
|
71
|
+
return [getplatform, ENV["_system_version"]]
|
72
|
+
end
|
73
|
+
#Now we ignorantly :D scrape the client's username
|
74
|
+
#but the scrape will fail if they are not in
|
75
|
+
# command line, so we will use begin/rescue to
|
76
|
+
#resolve errors:
|
77
|
+
def scrape_username
|
78
|
+
un=ENV["USER"] if onUnix?;
|
79
|
+
un=ENV["USERNAME"] if onWindows?||!onUnix?;
|
80
|
+
un="Great One" if un===nil||un.index("root")!=nil;
|
81
|
+
|
82
|
+
return un
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
#===== Variable Declarations ===
|
87
|
+
#GG Code Variables
|
88
|
+
$client_info={
|
89
|
+
:platform=>getplat(),
|
90
|
+
:ip=>"192.168.1.1",
|
91
|
+
:username=>scrape_username,
|
92
|
+
:syshash=>ENV
|
93
|
+
}
|
94
|
+
$begsurvdone=false;
|
95
|
+
def beginning_survey
|
96
|
+
puts "\n\n\n\n Hey "+scrape_username+", I see you have properly installed GameGrid! Don't just leave the GameGrid folder in "+ENV["PWD"]+"(downloads), why don't you move it to your Apps folder in /Applications or "+ENV["HOME"]+" for better access? Also, why don't you take this itty-bitty, 3-question survey before you start the game? Remember, we are testing for bugs, and this would really help. When the survey is finished, it will formulate some lettered code. Copy that and email it to tt2d [at] icloud [dot] com. Ready? The survey has begun!"
|
97
|
+
puts "\n Where did you learn about GameGrid? (aka. Google Search, GitHub, flyer, friend told me, etc)"
|
98
|
+
answer1=gets.chomp
|
99
|
+
puts "\n From where did you install GameGrid? (aka. GitHub, I locally had it, friend sent the files in an email, download site, etc)"
|
100
|
+
answer2=gets.chomp
|
101
|
+
puts "\n What out of these 5 categories do you describe yourself as: developer, gamer, tester, kid, parent? (you can type anything else if these don't suit you)"
|
102
|
+
answer3=gets.chomp
|
103
|
+
|
104
|
+
|
105
|
+
arr=[answer1,rand(99999999999),answer2,rand(99999999999),answer3,rand(999999999),rand(12112121),"-/fhih983293820-",$ip]
|
106
|
+
arrs=arr.to_s
|
107
|
+
puts "Thank you! See the code below? Copy that and email it to tt2d [at] icloud [dot] com. Thanks so much! To start playing, type play."; begsurvdone=true;
|
108
|
+
return arrs
|
109
|
+
end
|
110
|
+
$githubaddr="http://www.github.com/Adihaya/GameGrid/?ref=learnstreet.com/scratchpad/ruby?ggplay";
|
111
|
+
$modechoices={ :player=>0, :developer=>1, :administrator=>2 }
|
112
|
+
$mode=$modechoices[:developer]
|
113
|
+
|
114
|
+
$client_info[:ip]=$ip;
|
115
|
+
rescue LoadError
|
116
|
+
$platsur="browser (error)";
|
117
|
+
log("RESCUED ERROR: IP Pooling (Socket:getaddrinfo): platform communicated as 'cp' but detected as browser")
|
118
|
+
retry
|
119
|
+
end
|
120
|
+
|
121
|
+
# Important Variables
|
122
|
+
$lives=5; $energy=100; $altitude=10;
|
123
|
+
$tutorialon=true;
|
124
|
+
$dimension=1; $sector=1;
|
125
|
+
#System Constants
|
126
|
+
$cursession=1; $playid=rand(9^5);
|
127
|
+
$credits="Game created completely by Adihaya. Help in testing comes from VasantVR.\n See out GitHub address for all our GameGrid code:\n'"+$githubaddr+"'"
|
128
|
+
|
129
|
+
#A Point is an area on the gamegrid
|
130
|
+
class Point
|
131
|
+
#Attributes of your point
|
132
|
+
attr_accessor :x, :y, :object, :gtype
|
133
|
+
attr_reader :id, :ground
|
134
|
+
|
135
|
+
#Ifdo: What might happen if you do <action>?
|
136
|
+
def ifdo(action)
|
137
|
+
actionlist=["fall","jump","swim","sit"]
|
138
|
+
resultsperType={
|
139
|
+
"rocksolid"=>['You will lose 1/2 lives, lose 8 altitude', 'You will lose 5 energy, gain 3 altitude', 'Not possible','You will lose 4 altitude, lose 2 energy'],
|
140
|
+
"softy"=>['You will lose 8 altitude','You will lose 5 energy, gain 3 altitude', 'Not possible', 'You will lose 4 altitude, lose 1 1/2 energy'],
|
141
|
+
"dangerous"=>['You will lose 3 1/2 lives, lose 8 altitude', 'You will lose 10 energy, gain 3 altitude', 'You will lose 4 1/2 lives','You will lose 4 altitude, lose 2 1/2 lives']
|
142
|
+
}
|
143
|
+
if (resultsperType.include?(@gtype)===false) then
|
144
|
+
raise "Ground Type does not comply"
|
145
|
+
end
|
146
|
+
myresults=resultsperType[@gtype]
|
147
|
+
if (actionlist.include?(action)===false) then
|
148
|
+
raise "Action type does not comply"
|
149
|
+
end
|
150
|
+
ordernum=actionlist.index(action)
|
151
|
+
result=myresults[ordernum]
|
152
|
+
log(self.to_s+": .ifdo function called, result='"+result+"'")
|
153
|
+
return result
|
154
|
+
end
|
155
|
+
|
156
|
+
#SetGType: What type of ground am I standing on?
|
157
|
+
def setGType
|
158
|
+
case @ground;
|
159
|
+
when "asphalt", "rock", "concrete", "wood"
|
160
|
+
@gtype="rocksolid"
|
161
|
+
when "carpet", "bed", "mat"
|
162
|
+
@gtype="softy"
|
163
|
+
when "lava", "magma", "fire", "spikes", "poison"
|
164
|
+
@gtype="dangerous"
|
165
|
+
end
|
166
|
+
return @gtype;
|
167
|
+
end
|
168
|
+
|
169
|
+
#Result: Do (action) for me.
|
170
|
+
def result(action)
|
171
|
+
actionlist=["fall","jump","swim","sit"]
|
172
|
+
resultsperType={
|
173
|
+
"rocksolid"=>['$lives-=0.5; $altitude-=8', '$energy-=5; $altitude+=3', '','$altitude-=4; $energy-=2'],
|
174
|
+
"softy"=>['$altitude-=8','$energy-=5; $altitude+=3', '', '$altitude-=4, $energy-=1.5;'],
|
175
|
+
"dangerous"=>['$lives-=3.5; $altitude-=8', '$energy-=10; $altitude+=3', '$lives-=4.5','$altitude-=4; $lives-=2.5']
|
176
|
+
}
|
177
|
+
if (resultsperType.include?(@gtype)===false) then
|
178
|
+
raise "Ground Type does not comply"
|
179
|
+
end
|
180
|
+
myresults=resultsperType[@gtype]
|
181
|
+
if (actionlist.include?(action)===false) then
|
182
|
+
raise "Action type does not comply"
|
183
|
+
end
|
184
|
+
ordernum=actionlist.index(action)
|
185
|
+
result=myresults[ordernum]
|
186
|
+
puts ifdo(action)
|
187
|
+
eval(result)
|
188
|
+
end
|
189
|
+
#Ground=: Set the ground to any ground area (aka. rock)
|
190
|
+
def ground=(target)
|
191
|
+
@ground=target
|
192
|
+
setGType()
|
193
|
+
end
|
194
|
+
|
195
|
+
#Initialize: Set the required variables in the beginning of time
|
196
|
+
def initialize(x,y,ground,object=nil)
|
197
|
+
@id=rand(999999999)
|
198
|
+
@x=x
|
199
|
+
@y=y
|
200
|
+
@ground=ground
|
201
|
+
if object!=nil then
|
202
|
+
@object=object
|
203
|
+
else
|
204
|
+
@object=nil
|
205
|
+
end
|
206
|
+
obj=object
|
207
|
+
if (obj===nil) then
|
208
|
+
obj=" no objects"
|
209
|
+
end
|
210
|
+
setGType();
|
211
|
+
puts "Point created at #{@x}, #{@y}, on #{@ground}, with"+obj
|
212
|
+
end
|
213
|
+
def getloc
|
214
|
+
return 'hi'
|
215
|
+
end
|
216
|
+
|
217
|
+
#This: Basic info about this point
|
218
|
+
def this
|
219
|
+
if (@object===nil) then
|
220
|
+
return 'at '+@x.to_s+', '+@y.to_s+', on '+@ground+', with no objects found.'
|
221
|
+
else
|
222
|
+
return 'at '+@x.to_s+', '+@y.to_s+', on '+@ground+', with a '+@object+' found on the ground.'
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
class Grid
|
228
|
+
attr_accessor :points, :center, :origin, :xmin, :xmax, :ymin, :ymax, :area, :xdif, :ydif, :ground; attr_reader :id, :visualizer
|
229
|
+
@id=rand()
|
230
|
+
def [](x,y)
|
231
|
+
xypair=[x,y]
|
232
|
+
return @points[xypair]
|
233
|
+
end
|
234
|
+
def []=(x,y,to) #Make sure to actually syntax like this: [x,y]=to
|
235
|
+
xypair=[x,y]
|
236
|
+
@points[xypair]=to;
|
237
|
+
end
|
238
|
+
def update
|
239
|
+
@area=(@xmax-@xmin+1)*(@ymax-@ymin+1)
|
240
|
+
@xdif=(@xmax-@xmin+1);@ydif=(@ymax-@ymin+1)
|
241
|
+
end
|
242
|
+
def updpoints(gr=@ground)
|
243
|
+
puts "Updating points on grid...\n GRID UPDATE NOTICE: You are using updpoints, the latest version of the official Grid Point Updater!"
|
244
|
+
update()
|
245
|
+
begin
|
246
|
+
keepsetting1=true; xnum=@xmin; ynum=@ymin; xmax=@xmax; ymax=@ymax; xnumy=@xmin;
|
247
|
+
while (keepsetting1===true) do
|
248
|
+
|
249
|
+
ynumy=@ymin;
|
250
|
+
keepsetting2=true;
|
251
|
+
while (keepsetting2===true) do
|
252
|
+
curpoint=Point.new(xnum,ynumy,gr);
|
253
|
+
pair=[xnum,ynumy]
|
254
|
+
@points[pair]=curpoint
|
255
|
+
ynumy+=1
|
256
|
+
if (ynumy>ymax)
|
257
|
+
keepsetting2=false; break;
|
258
|
+
end
|
259
|
+
end
|
260
|
+
xnum+=1
|
261
|
+
if (xnum>xmax)
|
262
|
+
keepsetting1=false; break;
|
263
|
+
end
|
264
|
+
end
|
265
|
+
if (@area===@points.length) then; log("Grid:updpoints:success"); else; error("Grid:updpoints:failed grid.area='#{@area}', grid.points.length='#{@points.length}', area!=points.length",IndexError); end
|
266
|
+
rescue IndexError
|
267
|
+
@area=@points.length
|
268
|
+
retry
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
272
|
+
def initialize(xmin,xmax,ymin,ymax,origin=[0,0],center=[0,0],ground="asphalt")
|
273
|
+
begin
|
274
|
+
xmax-=1; ymax-=1;
|
275
|
+
@id=rand()
|
276
|
+
@xmin=xmin;@xmax=xmax;@ymin=ymin;@ymax=ymax;
|
277
|
+
@area=(@xmax-@xmin+1)*(@ymax-@ymin+1)
|
278
|
+
@xdif=(@xmax-@xmin+1);@ydif=(@ymax-@ymin+1)
|
279
|
+
@origin=origin
|
280
|
+
@center=center
|
281
|
+
@points={};
|
282
|
+
@ground=ground
|
283
|
+
@visualizer="run visualize method on this grid to set visualizer"; @oldvisualizers=[]
|
284
|
+
updpoints()
|
285
|
+
rescue
|
286
|
+
xmin=0,xmax=0,ymin=0,ymax=0,ground="asphalt"
|
287
|
+
retry
|
288
|
+
end
|
289
|
+
puts "Initialized Grid."
|
290
|
+
end
|
291
|
+
def visualize(point=nil)
|
292
|
+
puts "Converting Point elements to Arrays..."
|
293
|
+
plotmarks=point if point.class===Array;
|
294
|
+
plotmarks=[point.x,point,y] if point.class===Point;
|
295
|
+
xdif=@xdif; ydif=@ydif
|
296
|
+
xline="|"+" o "*xdif+"|\n"
|
297
|
+
yplnum=@ymax+1; full = " "+"___"*(xdif)+"\n"
|
298
|
+
while(yplnum>@ymin)
|
299
|
+
curd=""
|
300
|
+
curd=" " if (yplnum<10&&yplnum>(-1))
|
301
|
+
full+=(yplnum.to_s+curd+xline); yplnum-=1;
|
302
|
+
break if (yplnum<=@ymin);
|
303
|
+
end
|
304
|
+
#full=xline*ydif
|
305
|
+
xplotters = " "; xplnum=@xmin+1; xplotters=" " if @xmin<0;
|
306
|
+
puts "Measuring plot size... Calculating Areas..."
|
307
|
+
while(xplnum<=@xmax+2)
|
308
|
+
curd,curd2=" "; curd=" ".to_s if xplnum<0;
|
309
|
+
xplotters+=curd.to_s+xplnum.to_s+curd2.to_s;
|
310
|
+
xplnum+=1
|
311
|
+
break if xplnum>=@xmax+2;
|
312
|
+
end
|
313
|
+
puts "Processing visualization..."
|
314
|
+
full+=" "+"___"*(xdif)+"\n";full+=xplotters
|
315
|
+
@visualizer=full; @oldvisualizers.push(full)
|
316
|
+
puts full
|
317
|
+
end
|
318
|
+
|
319
|
+
end
|
320
|
+
|
321
|
+
$battle = {
|
322
|
+
'target'=>:knee,
|
323
|
+
'opponent'=>{'name'=>:bandit,
|
324
|
+
'lives'=>3,
|
325
|
+
'energy'=>50,
|
326
|
+
'active'=>true,
|
327
|
+
'weapon'=>:stick,
|
328
|
+
'weakpoint'=>:knee},
|
329
|
+
'type'=>:closed_combat
|
330
|
+
}
|
331
|
+
|
332
|
+
$plugins={
|
333
|
+
"GG Installer"=>"GG Plugins/install.rb"
|
334
|
+
}
|
335
|
+
|
336
|
+
#Create Directories
|
337
|
+
def makedir(path)
|
338
|
+
create_dirs=true
|
339
|
+
begin
|
340
|
+
if create_dirs===true then
|
341
|
+
require "fileutils"
|
342
|
+
|
343
|
+
|
344
|
+
FileUtils.mkdir_p(path) unless File.exists?(path)
|
345
|
+
end
|
346
|
+
rescue LoadError
|
347
|
+
puts "Error: access denied";create_dirs=false; retry
|
4
348
|
end
|
349
|
+
end
|
350
|
+
file_main=true;begin
|
351
|
+
#if (file_main===true) then
|
352
|
+
#makedir("~/.gg_internals/")
|
353
|
+
# Create a new file for GG and write to it
|
354
|
+
#File.open('~/.gg_internals/main.rb', 'w') do |f2|
|
355
|
+
# # use "\n" for two lines of text
|
356
|
+
#f2.puts "scores=[0]"
|
357
|
+
#end
|
358
|
+
#File.open('~/.gg_internals/welcome.html', 'w') do |f2|
|
359
|
+
# use "\n" for two lines of text
|
360
|
+
# f2.puts "<!DOCTYPE html><html><body>Hello, we see that you've now visited GameGrid Internals. This file 'welcome.html' was stored in '~/.gg-internals/', the official folder of GameGrid gadgets, tools, and internal algorithms. Feel free to mess around with everything, but be slightly cautious about what you do. Take a look around! <br><br>Thanks, The GG Team</body></html>"
|
361
|
+
#end
|
362
|
+
#end
|
363
|
+
rescue
|
364
|
+
file_main=false
|
365
|
+
puts "...."; retry;
|
366
|
+
end
|
367
|
+
|
5
368
|
|
6
|
-
|
7
|
-
|
8
|
-
|
369
|
+
|
370
|
+
|
371
|
+
#Create $loc, the point you are standing on (current location)
|
372
|
+
$loc=Point.new(1,1,'asphalt'); puts "^ $loc creation".center(50)
|
373
|
+
#Create $grid, the local point grid
|
374
|
+
puts "Creating $grid...".center(50); puts "===Grid Point Initialization===".center(50)
|
375
|
+
$grid=Grid.new(0,10,0,10)
|
376
|
+
# ============= Commands ========
|
377
|
+
$minusamt=2; $eminusamt=3;
|
378
|
+
def attack(targ)
|
379
|
+
error("target needs to be Symbol (:target)",ArgumentError) if targ.class!= Symbol;
|
380
|
+
$battle['target']=targ
|
381
|
+
targets=[:knee,:hands,:lhand,:rhand,:rleg,:lleg,:eyes,:mouth,:nose,:face,:head,:lap,:thighs,:stomach,:tummy,:neck]
|
382
|
+
if targ==$battle['opponent']['weakpoint'] then
|
383
|
+
$battle['opponent']['lives']-=$eminusamt;
|
384
|
+
else
|
385
|
+
$battle['opponent']['lives']-=$minusamt;
|
386
|
+
end
|
387
|
+
puts "Attacked the #{$battle['opponent']['name'].to_s}'s #{targ.to_s}!"
|
388
|
+
|
389
|
+
end
|
390
|
+
$dead=false;
|
391
|
+
def checkdeads
|
392
|
+
if ($lives<=0) then; $dead=true; end;
|
393
|
+
end
|
394
|
+
def evoke(magic)
|
395
|
+
magic=magic.to_s
|
396
|
+
if (magic.index('whitemagic')!=nil) then
|
397
|
+
$lives+=2;
|
398
|
+
end
|
399
|
+
if (magic.index('greenmagic_levitate')!=nil) then
|
400
|
+
$altitude+=5;
|
401
|
+
end
|
402
|
+
puts "Magic evoked."
|
403
|
+
end
|
404
|
+
def webhost!
|
405
|
+
puts "Your host Internet Protocol Address (IP) is: \n"+$ip;
|
406
|
+
end
|
407
|
+
def combine(*material)
|
408
|
+
hash={'use'=>'craft', 'combined'=>true, 'material'=>material, 'id'=>rand(9999999999999)}
|
409
|
+
puts hash
|
410
|
+
end
|
411
|
+
def craft(formation, combination)
|
412
|
+
combination['material'].map!(&:to_s); formation=formation.to_s
|
413
|
+
fullmapper={
|
414
|
+
'sword'=>{ ["cotton", "iron", "water"]=>":rust_sword" },
|
415
|
+
'umbrella'=>{ ["iron","plastic","steel"]=>":reinforced_metallic_umbrella"}
|
416
|
+
}
|
417
|
+
materials=combination['material'].sort;
|
418
|
+
shmapper=fullmapper[formation.to_s]
|
419
|
+
wnum=0; trud=false;
|
420
|
+
tool=shmapper[materials];
|
421
|
+
puts "\nCrafting...\n\n Here is your tool:\n"
|
422
|
+
puts tool
|
423
|
+
end
|
424
|
+
$weapon_choices=[:stone_sword, :rust_sword, :iron_sword, :blackmagic_sword, :whitemagic_sword, :yinyang_sword, :diamond_sword, :stone_ax, :rust_ax, :iron_ax, :diamond_ax, :fists, :firebreath, :hyperbeam, :powerbeam];
|
425
|
+
$weapon= :fists;
|
426
|
+
#Walk: walk around the grid
|
427
|
+
def walk(up,right)
|
428
|
+
$loc.x+=up
|
429
|
+
$loc.y+=right
|
430
|
+
puts "Walked #{up} points up, and #{right} points to the right. Standing on #{$loc.x}, #{$loc.y}. Location: #{$loc.this}"
|
431
|
+
end
|
432
|
+
fell=false;
|
433
|
+
|
434
|
+
#Fall: fall down onto the ground (ouch)
|
435
|
+
def fall()
|
436
|
+
$loc.result("fall")
|
437
|
+
fell=true;
|
438
|
+
puts "\n"
|
439
|
+
end
|
440
|
+
|
441
|
+
#Lives!: access the lives variable
|
442
|
+
def lives!
|
443
|
+
puts $lives;
|
444
|
+
end
|
445
|
+
|
446
|
+
#Energy!: access the energy variable
|
447
|
+
def energy!
|
448
|
+
puts $energy
|
449
|
+
end
|
450
|
+
#Altitude!: access the altitude variable
|
451
|
+
def altitude!
|
452
|
+
puts $altitude
|
453
|
+
end
|
454
|
+
$tutorialcomp=false;
|
455
|
+
|
456
|
+
|
457
|
+
#SystemConstant Access commands
|
458
|
+
def credits?
|
459
|
+
puts $credits
|
460
|
+
end
|
461
|
+
def log?
|
462
|
+
puts $console[:log]
|
463
|
+
end
|
464
|
+
def errors?
|
465
|
+
puts $console[:errors]
|
466
|
+
end
|
467
|
+
def getconsole?
|
468
|
+
puts $console
|
469
|
+
end
|
470
|
+
|
471
|
+
def email_to_name(email)
|
472
|
+
name = email[/[^@]+/]
|
473
|
+
name.split(".").map {|n| n.capitalize }.join(" ")
|
474
|
+
end
|
475
|
+
|
476
|
+
#============== END Commands =====
|
477
|
+
#Play: start the game tutorial
|
478
|
+
def tutorial
|
479
|
+
if ($tutorialon===true) then
|
480
|
+
$loc.x=1; $loc.y=1; # Reset current loc
|
481
|
+
puts "Hello, my friend "+$client_info[:username]+", I've been waiting to show you this very cool computer video game called GameGrid. The weird part is, you don't see anything, you just type commands and stuff! Here, why don't we begin the tutorial.\n\n\n"
|
482
|
+
puts "GameGrid - Official Tutorial!".center(75);
|
483
|
+
puts "Welcome to GameGrid, the in-console game. You are currently standing on something called a Point. You are standing "+$loc.this
|
484
|
+
puts "Points are locations on the gamegrid. You can also move around by executing commands. Why don't you try typing walk(1,0) ?"
|
485
|
+
command=gets
|
486
|
+
eval(command)
|
487
|
+
if $loc.x===2 then
|
488
|
+
p1over=true;puts "\n Congrats! Did you see that? You moved up on the GameGrid, by 1 point. Using the walk(up,right) command lets your player abstractly walk the grid.";
|
489
|
+
else
|
490
|
+
p1over=false; return "Are you sure you typed walk(1,0) exactly? I don't think so. Remember to type EXACTLY what is shown. Type tutorial to retry the tutorial.";
|
491
|
+
end
|
492
|
+
|
493
|
+
if (p1over===true) then
|
494
|
+
fell=false;
|
495
|
+
$loc.ground="asphalt"
|
496
|
+
puts "Okay, now let's talk about the ground. The ground you currently stand on, is asphalt. You might be thinking, asphalt's just fine. But try this: type command fall() and watch the results."
|
497
|
+
$lives=5; $altitude=10; $energy=100;
|
498
|
+
command=gets
|
499
|
+
eval(command)
|
500
|
+
p2over=false;
|
501
|
+
p2over=true if ($lives===4.5&&$altitude===2);
|
502
|
+
end
|
503
|
+
|
504
|
+
if (p2over===true) then
|
505
|
+
puts "Excellent! You really know what you're doing."
|
506
|
+
puts "Okay, you know how to walk and fall. You might think you already know how to do everything. But in this game... in this dimension.... "
|
507
|
+
puts "You... Are... BLIND"
|
508
|
+
puts "\n No, I mean it. In GameGrid, you conquer with a disadvantage: you can't see. You have to do actions like walking, by commanding you're loyal servant (his life is to help you with your blindness). "
|
509
|
+
puts "But... the goal of this journey... the reason you're playing here... is to overcome this disadvantage. To do so, you must capture The Royal Eyes from the evil Zuki. When you do so, you can see, better than anyone else (and win the game). But... we're not there yet. So let's get started, with more commands! (Ugh, this is boring, you might be thinking, but it'll help you lots)"
|
510
|
+
puts "\n Okay, lets learn about some important variables in your life. To access important variables, you attach a ! sign after it's name. One of the important variables, is lives. This is how many lives you have left. You start out with 5, and can have 5 as a maximum. To access this variable, you have to command lives! . More important variables include energy and altitude. Energy is how much energy you have in you. Activities (commands) like jumping, use up energy. You start with and have a max of 100 energy. Altitude is how high your head is from the ground. Sounds boring, but knowing the altitude helps in battles. To command for energy and altitude, you command energy!, and altitude!. Why don't you try commanding for one of these important variables?"
|
511
|
+
command=gets.chomp+""
|
512
|
+
eval(command); p3over=false;
|
513
|
+
if (command.index("!")!=nil) then
|
514
|
+
p3over=true;
|
515
|
+
puts "\n\nYay! You did it! Typing commands for variables like the one you typed: "+command+" helps in the future."
|
516
|
+
end
|
517
|
+
end
|
518
|
+
if (p3over===true) then
|
519
|
+
puts "\n\n\n Now let's learn about some (a bit boring) stuff. Lets learn about system constants. These constants are system-specified. One of them is called credits. Credits are not very important to you, but they tell you who helped create GameGrid. Credits can be accessed via the credits? command. Commands that end with the ? sign are system constants. Another system constant is log and errors. The log shows system developer operations, errors shows errors that occured in the system. Logs are accessed with the log? command, errors with the errors? command. Why don't you check out the credits, by typing credits? below:\n"
|
520
|
+
command=gets.chomp; p4over=false;
|
521
|
+
eval(command)
|
522
|
+
p4over=true if command.index('credits?')!=nil;
|
523
|
+
puts "Are you sure you typed 'credits?' exactly? Don't type for an other system variable like log?, as we wanted you to type for the credits variable. Type tutorial to retry." if p4over===false;
|
524
|
+
end
|
525
|
+
if (p4over===true) then
|
526
|
+
puts "Okay, one last, very critical thing before something awesome and fun: $loc and $grid. These 2 commands are very powerful. They are called 'codejectors' or CJ's. The $loc command outputs a CJ classified as a Point, which is an area on the GameGrid. It represents your current location. The $grid command outputs a CJ, classified as a Grid. It is the actual GameGrid, with tens to thousands of associated points. When you command for these CJs, they will show you some code. You may not understand it, but that doesn't matter. You have to utilitize the 'methods' on these CodeJectors. Methods are ways to uncover info, or do a function. The $loc.this function shows you info about where you're at. $loc.x and $loc.y show you your coordinates. If you command this: $grid[x,y] and replace x and y with valid coordinate numbers, it will show you a CJ for the point on that coordinated area.\n\nWhy don't you type $grid.points, just to see the code (code means, basically your computer's native language) on that CJ that stores the grid's points?"
|
527
|
+
command=gets
|
528
|
+
if (command.index("$grid.points")!=nil) then
|
529
|
+
puts $grid.points
|
530
|
+
puts "Great job! See all that code? It may seem weird to you, but trust me, once you learn a code language like Ruby or JavaScript, you'll see how simple and effective it is. Let's move on to new stuff, man!"
|
531
|
+
else; return "I don't think you commanded for $grid.points. Try again.";
|
532
|
+
end
|
533
|
+
|
534
|
+
|
535
|
+
puts "\n\nYou're a fast learner! But the most important thing we need to learn: battles. Let's begin our battle tutorial. \n\n Pretend you're walking on the street, and you see a bandit with his weak weapon: a stick. It's time for you to learn how to battle. Your weapon currently: kitchen knife. Okay, before you get noticed, jab him on the knee. Type 'attack(:knee)'."
|
536
|
+
command=gets; p5_1over=false;
|
537
|
+
if(command.index("attack")!=nil&&command.index(":")!=nil) then
|
538
|
+
p5_1over=true
|
539
|
+
else
|
540
|
+
return "Oh no! We couldn't parse (understand) your command. The bandit noticed you and hit you in the eye. You immediately fainted. Please try the tutorial again."
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
if (p5_1over===true) then
|
545
|
+
puts "Good job! He immediately fell down, and started examining his wound on his #{$battle[:target]}. Oh, no! He noticed you! He drops his weapon in awe. Quick! Get his weapon! Type pickup(:weapon) to grab his beating stick."
|
546
|
+
command=gets; p5_2over=false;
|
547
|
+
if (command.index("pickup")!=nil&&command.index(":weapon")!=nil) then
|
548
|
+
p5_2over=true;
|
549
|
+
else; return "Oh no! We couldn't parse (understand) your command. The bandit caught you and hit you in the eye. You immediately fainted. Please try the tutorial again."
|
550
|
+
end
|
551
|
+
end
|
552
|
+
if (p5_2over===true) then
|
553
|
+
$tutorialon=false; $tutorialcomp=true;
|
554
|
+
log("Tutorial completed.")
|
555
|
+
puts "Awesome! Now your neighbors have called the police. The job has been done. You know how to walk, jump, attack, get variables, and much more. Your first mission is done. Now get ready for some more awesomeness. The SpyForce have hired you! You now go by the secretive name, Agent X, and you must keep your real identity, "+scrape_username+", away from the public. Congratulations! You have successfully completed the tutorial.\n\n NOTICE: Hey "+scrape_username+", I haven't seen you in a while, so I might not remember your name right. Why don't you type your name or email, so I can recognize you right? (if you don't want to, type quit)"
|
556
|
+
nm=gets.chomp
|
557
|
+
return "Good job on finishing that tutorial!" if nm.index("quit")!=nil;
|
558
|
+
ENV['USER']=email_to_name(nm);
|
559
|
+
ENV['USERNAME']=email_to_name(nm);
|
560
|
+
puts "Hey, thanks "+ENV['USER']+", for reminding me of yourself! Continue doing awesome on GameGrid! Congrats for swiftly finishing up that tutorial!!!"
|
561
|
+
else; return "Oh no! We couldn't parse (understand) your command. The bandit caught you and hit you in the eye. You immediately fainted. Please try the tutorial again.";
|
562
|
+
end
|
563
|
+
if ($tutorialon===false) then
|
564
|
+
puts "DEVProto"
|
565
|
+
log("Tutorial access denied: $tutorialon=false")
|
566
|
+
|
567
|
+
end
|
568
|
+
end
|
569
|
+
if ($tutorialon===false) then
|
570
|
+
puts "DEVProto"
|
571
|
+
log("Tutorial access denied: $tutorialon=false")
|
572
|
+
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
576
|
+
$loadedplugin=''
|
577
|
+
|
578
|
+
|
579
|
+
#Play: start playing GameGrid!
|
580
|
+
def play
|
581
|
+
#Check if tutorial is completed.
|
582
|
+
if ($tutorialcomp!=true) then; return "Please complete the tutorial by typing tutorial and hitting enter, before you start the game. To start the tutorial, type 'tutorial' and hit the enter/return key."; end;
|
583
|
+
|
584
|
+
#Sector -1 is a Developer testing sector.
|
585
|
+
if ($sector==-1)
|
586
|
+
puts "Welcome, to the Developer Plugin Test sector, referred to as Sector -1. Use this sector to access loaded plugins, easily. DO NOT use Sector 0, for any uses, unless you are an administrator of GameGrid. Thank you. The loaded plugin is processing... When done loading, your most recently installed plugin will activate...\n\n"
|
587
|
+
eval($loadedplugin)
|
588
|
+
end
|
589
|
+
if ($dimension==1) then
|
590
|
+
#==== D1, S1====#
|
591
|
+
if ($sector==1) then
|
592
|
+
puts "Hello, and welcome to GameGrid! We see you've completed the tutorial nicely, so we're letting you into Dimension I (or D1). The first dimension, is a new world to you. It's exactly where you'll begin your search for The Royal Eyes. They are your token to achieving a huge advantage, and unlocking Dimension II (D2). There are a few new variables you should master: $dimension, shows your current dimension,, $sector, shows your current sector. You don't really need a tutorial to practice those, so we're movin' on!\n\n"
|
593
|
+
puts "It looks like you're feeling thirsty. You see a water fountain, next to a stone wall. There's a guard, protecting that fountain. He's on Zuki (the villain)'s army. It's best to battle him, and go to that fountain. Let's do this. Come on, "+ENV['USER']+"!"
|
594
|
+
$loc.x=1; $loc.y=1;
|
595
|
+
#Battle Setup
|
596
|
+
$battle = {
|
597
|
+
'target'=>:knee,
|
598
|
+
'opponent'=>{'name'=>:guard,
|
599
|
+
'lives'=>4,
|
600
|
+
'energy'=>75,
|
601
|
+
'active'=>true,
|
602
|
+
'weapon'=>:stone_sword,
|
603
|
+
'weakpoint'=>:face},
|
604
|
+
'type'=>:close_combat
|
605
|
+
}
|
606
|
+
puts "\n\n Okay, we need to slowly approach him from the sides. When you do an attack while you weren't noticed, it has slightly greater effects. So make sure to walk, only up to 2 steps at a time, or else, he'll hear us. The guard stands at 4,2. Let's get him! But go slow. Remember how to walk? Start walking!"
|
607
|
+
while($loc.x!=4||$loc.y!=2)
|
608
|
+
command=gets; eval(command);
|
609
|
+
break if $loc.x==4&&$loc.y==2
|
610
|
+
end
|
611
|
+
if ($loc.x==4&&$loc.y==2)
|
612
|
+
puts "Good! Now let's punch him with our fists. He has 4 lives, 75 energy, and a stone sword. Just telling you, his weak point is his face. Remember how to use the attack command? Go for it!"
|
613
|
+
command=gets; eval command
|
614
|
+
if $battle['opponent']['lives']<3 then
|
615
|
+
puts "He lost "+(4-$battle['opponent']['lives']).to_s+" lives! He immediately ell to the ground, bruised by your punch. But he's still undefeated! We better get him back, again. Start the attack!"
|
616
|
+
command=gets; eval command;
|
617
|
+
if $battle['opponent']['lives']<1 then
|
618
|
+
puts "Awesome! He's defeated, and we can stock up on water! Right now, you have 80 energy. But let's take a drink! *gulp* *gulp* You now have 100 energy. Cool! Let's move on to Sector 2."
|
619
|
+
$sector=2;
|
620
|
+
puts "Welcome to Sector 2, of the first dimension."
|
621
|
+
end
|
622
|
+
end
|
623
|
+
end
|
624
|
+
end
|
625
|
+
#D1, S2
|
626
|
+
if ($sector==2) then
|
627
|
+
puts "Hello! You're currently in Sector 2, of Dimension 1. That grey, metallic factory over there pumps white magic, a special kind of magical substanced used to heal, or restore. But sadly, th factory owner sold it to the horrible Zuki. He plans to use white magic, to make himself invincible! You better put a stop sign to this business. When you go in, there'll be 3 guards waiting to kill you. These are not normal guards. When they want to attack, they float in the air, and twist and combine into one huge, one-eyed snake with all their power combined! The only way to defeat them, is to use a better weapon. Here, is a stone ax. It's not very powerful, but it's certainly better than your fists! Now go beat the juice outta them!"
|
628
|
+
$weapon= :stone_ax;
|
629
|
+
puts "type 'enter' to enter the factory"; ifenteredfac=false;
|
630
|
+
entered=gets; if (entered.index("e")!=nil) then; ifenteredfac=true; end;
|
631
|
+
if (ifenteredfac==true) then
|
632
|
+
puts "*you enter through the door*\n\n You see 3 men.\n\nBOOOM!!! The 3 men fly up in the air, and merge into a one-eyed, huge snake. It's killing time. Remember, think logically. You're battling a gigantic snake with one eye. What would be it's weakpoint? Engage the attack! Use the attack command. Remember, think logically. The snake can regenerate itself. But if you think logically, and hit it's weakpoint, it'll immediately collapse. Go!"
|
633
|
+
command=gets;
|
634
|
+
notquite= "Good hit! But the snake immediately regenerated it's health! Remember, think logically. What would be a huge, merged, one-eyed snake's weakpoint? Keep attacking!"
|
635
|
+
while(command.index(":eye")==nil)
|
636
|
+
puts "Good hit! But the snake immediately regenerated it's health! Remember, think logically. What would be a huge, merged, one-eyed snake's weakpoint? Keep attacking!"
|
637
|
+
command=gets
|
638
|
+
if (command.index(":eye")!=nil) then; break; end;
|
639
|
+
end
|
640
|
+
|
641
|
+
if (command.index(":eye")!=nil) then
|
642
|
+
puts "Awesome! Good job, thinking logically. The snake's eye gradually closed, and the snake burnt to ashes. Now, we need to stop this factory. Let's attack that circuit board, over there. Type attack(:circuitboard) to do so!"; facdestroyedd=false;
|
643
|
+
command=gets; if command.index(":circuitboard")!=nil then; facdestroyedd=true; else; puts "Oh no! You mistyped! The computer broke down. Type play to restart Sector 2, and use the answers you know to get back, and oh, remember to type correctly! :D"; end;
|
644
|
+
if (facdestroyedd==true) then
|
645
|
+
puts "Way to go! The circuits exploded, and the factory closed down. I put some white magic in your pockets, just in case. We can now get to Sector 3. Good job!"
|
646
|
+
$sector=3;
|
647
|
+
end
|
648
|
+
end
|
649
|
+
end
|
650
|
+
end
|
651
|
+
#D1, S3
|
652
|
+
if ($sector==3) then
|
653
|
+
$weapon=:stone_ax;
|
654
|
+
puts "Hello, and welcome to Sector 3. You are currently in a vast desert, it seems. But see that boulder over there? Behind that huge rock, is a 10-foot tall soldier. Many of our soldiers couldn't defeat such a large man. He's defense is very easy to overtake, but his attacks are powerful blows. First, let's get a better weapon. Look, over there! Someone seems to have forgotten their iron sword! Pick it up, using pickup(:iron_sword) command!"
|
655
|
+
command=gets; $weapon=:iron_sword if (command.index("pickup")!=nil&&command.index(":iron_sword")!=nil);
|
656
|
+
if ($weapon==:iron_sword) then
|
657
|
+
puts "Iron swords are much more powerful than stone axes. But more than attack power, we need defense. What about we use the white magic we stored? Here's a new command for you, called evoke. The evoke command activates the power of magic. For white magic, we call it like this: evoke(:whitemagic). This will help you in battle, when you only have 1 or 1/2 lives left. Let's take him by surprise at first. He's probably asleep right now. Go get him! Oh, and his weakpoint is his neck, as he fractured it very bad. But he's so tall, we can't even reach his neck! Wait, I have an idea! I'll teach you another evoke command: evoke(:greenmagic_levitate). It's long, but worth it. It'll raise your altitude! Use it now, to prepare:"; $altitude=10;
|
658
|
+
command=gets;
|
659
|
+
$altitude=15 if command.index("greenmagic_levitate")!=nil;
|
660
|
+
if ($altitude>14) then
|
661
|
+
$loc.x=6; $loc.y=2
|
662
|
+
puts "You're floating at altitude "+$altitude.to_s+"! Good, now let's get him well. He has 7 lives, and an iron sword, too. But don't worry, we'll defeat him. Use the evoke command on white magic to heal yourself. Let's do this! Let's creep up on him while he naps. Walk to 3,3, cause that's where he is. You are currently standing at 6,2. You need to walk to 3,3. Go! "
|
663
|
+
while($loc.x!=3||$loc.y!=3)
|
664
|
+
command=gets; eval(command);
|
665
|
+
break if $loc.x==3&&$loc.y==3
|
666
|
+
end
|
667
|
+
if ($loc.x==3&&$loc.y==3) then
|
668
|
+
#Battle Setup
|
669
|
+
$battle = {
|
670
|
+
'target'=>:knee,
|
671
|
+
'opponent'=>{'name'=>:soldier,
|
672
|
+
'lives'=>7,
|
673
|
+
'energy'=>75,
|
674
|
+
'active'=>false,
|
675
|
+
'weapon'=>:iron_sword,
|
676
|
+
'weakpoint'=>:neck},
|
677
|
+
'type'=>:close_combat
|
678
|
+
}
|
679
|
+
puts "Okay, good. So there he is. His sleeping pouch is like 15 feet long, so it can fit him! OK, first, let's sneak up a small attack on him. Remember, his weakpoint is his fractured neck. Go!"; $lives==5;
|
680
|
+
command=gets;
|
681
|
+
eval(command);
|
682
|
+
if $battle['opponent']['lives']<7 then
|
683
|
+
puts "YAWWWN! The giant soldier is waking up! Quick, get another hit on him!"
|
684
|
+
command=gets;
|
685
|
+
eval(command);
|
686
|
+
if $battle['opponent']['lives']<5 then
|
687
|
+
$lives-=3;
|
688
|
+
puts "URRRGH! The giant soldier is ready to attack! WHAP! Oh no, he whapped you in the face! His hits are VERY hard. You just lost 3 lives, and only have 2!!! Okay, you can either attack him back, or heal yourself magically, by evoking white magic. Go!"; #$lives-=3;
|
689
|
+
command=gets; eval(command)
|
690
|
+
|
691
|
+
puts "Good! The opponent still stands strong. He gets his fists ready for another whapping! Quick, do something! Either, you can heal yourself, with white magic, or attack him! What do you choose? Do it!"; command=gets; eval(command)
|
692
|
+
if ($battle["opponent"]["lives"]<=0) then
|
693
|
+
puts "Boom! The soldier slid to the ground, as his eyes closed, and his movement decreased. We did it! Let's move up to Sector 4."; $sector=4; return "Let's have some fun, cause we just entered the 4th Sector! Type play to start the 4th Sector!"; end
|
694
|
+
puts "Good job! You have #{$lives} lives, and the opponent has #{$battle['opponent']['lives']} lives. But the battle hasn't finished yet! Let's go and show him what we can do! Cause we are—WHAP! HE whapped you AGAIN!"; $lives-=3;
|
695
|
+
checkdeads();
|
696
|
+
return "OWW! Oh, that's not good. You died! Those hits were hard. Wait just a sec, I'll fix up your bruises. WHOOSH! There you go, all nice and healthy! Now go get that fiant dude again! Type play to retry that battle! " if dead==true;
|
697
|
+
puts "Okay, even though you only have #{lives} lives, I know we can still overtake him. You can either heal or attack, but I reccommend attacking, as your opponent has only a few lives, left. Go!"
|
698
|
+
command=gets; eval(command)
|
699
|
+
if ($battle["opponent"]["lives"]<=0) then; $sector=4;
|
700
|
+
puts "Boom! The soldier slid to the ground, as his eyes closed, and his movement decreased. We did it! Let's move up to Sector 4."; return "Let's have some fun, cause we just entered the 4th Sector! Type play to advance to Sector 4!"
|
701
|
+
else
|
702
|
+
puts "Oh no! I see that the opponent is preparing a SUPERBLAST! We should have attacked those times, instead of healing! BOOOOM!!!!!!!"; $lives==0; checkdeads();
|
703
|
+
return "OWW! Oh, that's not good. You died! Those hits were hard. Wait just a sec, I'll fix up your bruises. WHOOSH! There you go, all nice and healthy! Now go get that giant dude again! Type play to retry that battle! Oh, and try not to keep attacking or keep healing all the time!" if $dead==true;
|
704
|
+
|
705
|
+
end
|
706
|
+
end
|
707
|
+
end
|
708
|
+
end
|
709
|
+
end
|
710
|
+
|
711
|
+
end
|
712
|
+
|
713
|
+
end
|
714
|
+
#D1, S4
|
715
|
+
if ($sector==4) then
|
716
|
+
puts "You look tired, fromm battling all those badguys! So I registered you in Crafting Class, a class, where they teach you the art of crafting. Crafting is a fundamental way to create Tools out of Substances. Let's learn how to craft!\n\nOkay, first, crafting is 60% Logic, 25% Background Knowledge, and 15% Randomness. So you need to think of substances that, when combined, create the tool you are looking for. Today, we will build a rust sword, which is very similar to the iron sword, but has a bit more advantages. Technically, when crafting, nobody will help you, but today, I will assist you while crafting. Before skipping to the next paragraph, think of the core materials needed for the rust sword!\n\nOkay, so you might have thought of rust, and cotton which is used to make the part where you hold the sword. These are still not correct! When crafting, we need to keep breaking down the substances as much as possible. So we break down rust, into...... iron and water! So iron, water, and cotton make the rust sword! But, we need to structure this out, so we don't end up crafting a rusty nail in a cotton bag! How do we do that? By using formations! Formations are the key structure behind your tool. The formation of a rust sword, would be the 'sword' formation. In the next paragraph, we'll get into the method of crafting.\n\nTo craft, you use the combine and craft commands. First, we need to combine all 3 fundamental elements. Type combine(:water, :iron, :cotton) in any order:\n\n"
|
717
|
+
command=gets; eval(command)
|
718
|
+
if (command.index(":water")!=nil&&command.index(":iron")!=nil&&command.index(":cotton")!=nil&&command.index("combine")!=nil) then
|
719
|
+
puts "\n\nDid you see that weird stuff it gave off? Looks weird, but it is key to crafting. So copy that stuff above (select it with cursor, then CTRL+C or COMMAND+C) for crafting's sake. Now, lets actually craft it! Remember, the formation is :sword. So start typing craft(:sword, and then stop typing. Now paste all that weird stuff you just copied (CTRL+V or COMMAND+V). After pasting, type an ending bracket ) to finish it off. Hit enter, to see if it worked!"
|
720
|
+
command=gets; eval(command)
|
721
|
+
if (command.index('material')!=nil) then
|
722
|
+
puts "Congrats! You crafted your first sword. I'll let you keep that rust sword for future battles. Let's go to Sector 5!\n\n"; sector=5;
|
723
|
+
else; puts "Oh no, that's not correct. Command play to try again."; end;
|
724
|
+
end
|
725
|
+
end
|
726
|
+
#D1, S5
|
727
|
+
if ($sector==5) then
|
728
|
+
puts "Hi, and welcome to the 5th Sector. See that man over there, surrounded by bodyguards, soldiers, and a 15-people army? That's Yuni, Zuki's close brother. Yuni is very greedy, and is very talented at the art of trickery and technology. He guards the tunnel into the 2nd Dimension, where Zuki resides. We need to get through him. And a battle is waiting to happen. But don't think about swords and axes. His duels are in knowledge, because he has something called Bing, which lets him find answers to all questions. He'll ask a question, you'll need to type the answer. If you answer all 3 questions correct, he will let you pass into the portal. But don't worry, cause you have something called Google, at your side. Open www.google.com and search for answers. 1 question is also multiple choice, and you must type the letter of your answer. Get Google ready! Type anything and press enter to begin."
|
729
|
+
typeanything=gets; yqn=1; wrongsentence="Yuni:' THAT'S WRONG! HA! HA! ' What a mean guy. Just type play and hit enter, to retry."
|
730
|
+
if (yqn==1) then
|
731
|
+
puts "Yuni: What is the meaning of 'endemic'? Type the letter of your answer:"
|
732
|
+
puts "\n\n[a]: characteristic of or prevalent in a particular field, area, or environment"
|
733
|
+
puts "\n[b]:a virus like the flu, which gets passed around easily"
|
734
|
+
puts "\n[c]:a local population of organisms of the same kind, especially one in which the genetic mix is similar throughout the group"
|
735
|
+
answer=gets.chomp.to_s;
|
736
|
+
yqn=2 if answer=="a";
|
737
|
+
return wrongsentence if answer!="a";
|
738
|
+
end
|
739
|
+
if (yqn==2) then
|
740
|
+
puts "\n\nYuni: What is a group of kangaroos called?"
|
741
|
+
answer=gets.chomp.to_s;
|
742
|
+
yqn=3 if answer=="mob"||answer=="herd"||answer=="troop";
|
743
|
+
return wrongsentence if answer!="mob"&&answer!="herd"&&answer&&"troop";
|
744
|
+
end
|
745
|
+
if (yqn==3) then
|
746
|
+
puts "\n\nYuni: What is the popular video sharing website, based and founded in November 2004?";
|
747
|
+
answer=gets.chomp.to_s;
|
748
|
+
yqn=4 if answer.index("vimeo")!=nil||answer.index("Vimeo")!=nil;
|
749
|
+
return wrongsentence if answer.index("vimeo")==nil&&answer.index("Vimeo")==nil;
|
750
|
+
end
|
751
|
+
if (yqn==4) then
|
752
|
+
puts "\n\n\nYuni: Arrrgh. You got throught me this time. **steps aside**\n\n"+scrape_username+", there's your portal to Dimension 2!! Let's hop in! WHOOOOOSH\n\n"; $dimension=2; $sector=1;
|
753
|
+
end
|
754
|
+
end
|
755
|
+
end
|
756
|
+
if ($dimension==2) then
|
757
|
+
if ($sector==1) then
|
758
|
+
puts "\nWelcome to Dimension 2. Although, you won't really feel welcome, cause I can summarize my thoughts like this: What a vast, dangerous garbage dump. It's like an entire world-wide landfill, set on fire! Dimension 2 is not where you'd want to be. But we're here, because the Zuki army lies in here, and we're here to defeat them. So we practically have no real choice. Oh well. We're currently a bit far from the area in which Zuki and his army resides in. And right now, it's raining lava. Good thing is, we're under our umbrella. But the umbrella's cracking! We need to craft a metallic umbrella! Go and craft an metal umbrella. Umbrella handles are made out of plastic, and the top must be iron and steel. Go craft, before we walk in a magma shower! Start combining elements, first: "
|
759
|
+
command=gets; eval command;
|
760
|
+
puts "Now copy what you got above, and craft it now, with the umbrella formation:"
|
761
|
+
command=gets; eval command;
|
762
|
+
if (command.index("id")!=nil&&command.index("umbrella")!=nil) then
|
763
|
+
puts "Whew, good! That was easy. Let's go to Sector 2!\n\n"; $sector=2;
|
764
|
+
end
|
765
|
+
end
|
766
|
+
if ($sector==2) then
|
767
|
+
puts "\n\nYou thought Dimension 2 was easy, cause Sector 1 was. But no, Dimension 2 is the opposite of heaven. Welcome to Sector 2 of the 2nd Dimension, although it's unwelcoming."
|
768
|
+
end
|
769
|
+
end
|
770
|
+
end
|
771
|
+
beginning_survey() unless $begsurvdone===true;
|
772
|
+
|
773
|
+
#PLUGINS
|
774
|
+
$useplugindata=true; #$ccellar='';
|
775
|
+
begin
|
776
|
+
if ($useplugindata) then
|
777
|
+
$plgvaldb='';
|
778
|
+
File.open("plgvaldb.rb", "r").each_line do |line|
|
779
|
+
$plgvaldb+=line
|
780
|
+
end
|
781
|
+
#rescue SyntaxError
|
782
|
+
|
783
|
+
$plgvaldb=eval($plgvaldb)
|
784
|
+
module Plugin
|
785
|
+
def self.new(rubycode, name="Plugin.new")
|
786
|
+
$plgvaldb[name.to_s]=rubycode.to_s
|
787
|
+
hasher={name.to_s=>rubycode.to_s}
|
788
|
+
puts "To install only locally, use Plugin.install(#{name}).\n To push to GameGrid servers, so the public can install your plugin, send an email with your Plugin name and Plugin code to tt2d [at] icloud [dot] com. \nTo see the output of your plugin, use self.load with an argument equal to this hash: \n"
|
789
|
+
return hasher
|
790
|
+
end
|
791
|
+
def self.load(hasher)
|
792
|
+
error("Argument must be a hash, formulated by Plugin.load(code,name) function",ArgumentError) if hasher.class!=Hash;
|
793
|
+
eval(hasher.values[0])
|
794
|
+
end
|
795
|
+
def self.loadAll(*pk)
|
796
|
+
loadnum=0
|
797
|
+
while (loadnum<pk.length)
|
798
|
+
self.load(pk[loadnum])
|
799
|
+
loadnum+=1;
|
800
|
+
end
|
801
|
+
end
|
802
|
+
def self.install(id)
|
803
|
+
puts "Tracking plugin ID..."
|
804
|
+
id=id.to_s
|
805
|
+
raker=$plgvaldb[id]
|
806
|
+
$loadedplugin=raker.to_s
|
807
|
+
puts "Your plugin, #{id} has been loaded. To run this plugin, you can either type $sector=-1; play if you have completed the tutorial, or you can type Plugin.run() to run the plugin, even if the tutorial was not done. Thank you."
|
808
|
+
end
|
809
|
+
def self.run()
|
810
|
+
raise "No plugin loaded yet", LoadError if ($loadedplugin=='');
|
811
|
+
eval($loadedplugin);
|
812
|
+
end
|
813
|
+
#eval($ccellar)
|
814
|
+
end
|
815
|
+
end
|
816
|
+
rescue
|
817
|
+
$useplugindata=false; log("Plugin content disable due to error rescuer"); retry
|
818
|
+
end
|
819
|
+
|