You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-88Lines changed: 50 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ It is up to you to discover most of the language through the progression system.
51
51
However, every good README needs a hello world.
52
52
53
53
```ruby
54
-
print("Hello, World!")
54
+
print"Hello, World!"
55
55
```
56
56
This can be written into a book, and right-clicked into a Copper Golem. right-click again to run.
57
57
<br />
@@ -73,14 +73,14 @@ You can join our discord server [here](https://discord.gg/2eR2hdYJMc).
73
73
## Oxidisation and progression
74
74
After a certain number of instruction executions, the golem will begin to oxidise.
75
75
Interacting with the golem while holding an axe removes the rust.\
76
-
If the golem is fully oxidised, it will not run anymore, but upon scraping it with an axe you will find example programs that explain the language of GolemScript.
76
+
If the golem is fully oxidised, it will not run anymore, but upon scraping it with an axe you will find example programs that explain the language of GolemScript.\
77
77
This process can be avoided however, by waxing the golem. As with anything copper, you can also scrape off the wax.
78
78
79
79
80
80
## GolemScript Documentation
81
81
The following (excellent) language documentation was written by xokz, from the MinecraftCommands discord.
82
82
83
-
By: xokz (Edited by RevolvingMadness)
83
+
By: xokz
84
84
85
85
Code goes in a book and quill. Code can span multiple pages, but make sure there is a new line after every page!. The name of the book does not matter.
86
86
Right click the minecart with the book to set the golems code, and right-click the minecart with a empty hand to execute the code.
@@ -90,7 +90,7 @@ Comments are indicated with a '#' and last until the end of the line. There are
90
90
91
91
EX.
92
92
```ruby
93
-
#This will not do anything since it is a comment
93
+
#this will not do anything since it is a comment
94
94
```
95
95
96
96
## 2. Variables
@@ -107,70 +107,55 @@ let str = "Hello"
107
107
let x =1
108
108
let arr = [9, 2, -3, 6]
109
109
let var = ["hello", "world"]
110
-
# 'fizz' is now 8
111
-
let fizz = foo + x
112
-
# 'buzz' is now 'world'
113
-
let buzz = var[x]
114
-
# 'bar' is now 4
115
-
let bar = var[2] +7
110
+
let fizz = foo + x # this will be 8
111
+
let buzz = var[x] # this will be 'world'
112
+
let bar = var[2] +7# this will be 4
116
113
let obj = {a:1,b:2+3}
117
114
```
118
115
119
116
Variables can be changed by simply redeclaring them.
120
117
121
118
EX.
122
119
```ruby
123
-
# 'foo' is now 7
124
120
let foo =7
125
-
# 'foo' is now 8 instead of 7
126
-
let foo =8
121
+
let foo =8# foo is now 8 instead of 7
127
122
```
128
123
129
124
Arrays can be added and removed from via addition and subtraction.
130
125
131
126
EX.
132
127
```ruby
133
128
let arr = [0, 1, 2]
134
-
# 'arr' is now [0, 1, 2]
135
-
let arr = arr +3
136
-
# 'arr' is now [0, 1, 2, 3]
137
-
let arr = arr -1
138
-
# 'arr' is now [0, 1, 2]
139
-
let arr = arr --1
140
-
# 'arr' is now [1, 2]
129
+
let arr = arr +3# arr is now [0,1,2,3]
130
+
let arr = arr -1# arr is now [0,1,2]
131
+
let arr = arr --1# arr is now [1,2]
141
132
```
142
133
143
134
Objects can be added and removed from via addition and subtraction.
144
135
145
136
EX.
146
137
```ruby
147
138
let obj = {a:1,b:2,c:3}
148
-
# 'obj' is now {a:1,b:2,c:3}
149
-
let obj = obj -"a"
150
-
# 'obj' is now {b:2,c:3}
151
-
let obj = obj + {c:5,d:4}
152
-
# 'obj' is now {b:2,c:5,d:4}
139
+
let obj = obj -"a"# obj is now {b:2,c:3}
140
+
let obj = obj + {c:5,d:4} # obj is now {b:2,c:5,d:4}
153
141
```
154
142
155
143
Strings can be added to with addition.
156
144
157
145
EX.
158
146
```ruby
159
147
let str ="hello"
160
-
print(str)
161
-
# This will print 'hello'
148
+
print str # this will print 'hello'
162
149
let var = str +", world!"
163
-
print(var)
164
-
# This will print 'hello, world!'
150
+
print var # this will print 'hello, world!'
165
151
```
166
152
167
153
Strings are just arrays of characters, so they can be indexed just like an array.
168
154
169
155
EX.
170
156
```ruby
171
157
let str ="hello, world!"
172
-
print(str[1])
173
-
# This will print 'e'
158
+
print str[1] # this will print 'e'
174
159
```
175
160
176
161
## 3. Printing
@@ -184,20 +169,13 @@ let bar = "xokz"
184
169
let arr = [0, 4, 7]
185
170
let obj = {hello:"world"}
186
171
187
-
print("Hello, world!")
188
-
# This will print 'Hello, world!'
189
-
print(foo)
190
-
# This will print 8
191
-
print(name)
192
-
# This will print 'xokz'
193
-
print(arr)
194
-
# This will print '[0, 4, 7]'
195
-
print(arr[1])
196
-
# This will print 4
197
-
print(arr[1] + foo)
198
-
# This will print 12
199
-
print(obj["hello"])
200
-
# This will print 'world'
172
+
print"Hello, world!"# this will print 'Hello, world!'
173
+
print foo # this will print 8
174
+
print name # this will print 'xokz'
175
+
print arr # this will print '[0, 4, 7]'
176
+
print arr[1] # this will print 4
177
+
print arr[1] + foo # this will print 12
178
+
print obj["hello"] # this will print 'world'
201
179
```
202
180
203
181
## 4. Sleep
@@ -208,10 +186,8 @@ The provided value is how many ticks the golem will sleep for.
208
186
EX.
209
187
```ruby
210
188
let time =7
211
-
# Sleep for 7 ticks
212
-
sleep time
213
-
# Sleep for 2 seconds, since 1 second is 20 ticks
214
-
sleep40
189
+
sleep time # sleep for 7 ticks
190
+
sleep40# sleep for 2 seconds, since 1 second is 20 ticks
215
191
```
216
192
217
193
## 5. If Statements
@@ -223,26 +199,22 @@ EX.
223
199
```ruby
224
200
let foo =0
225
201
if foo
226
-
print("success!")
227
-
# This will not print since the condition results in 0
202
+
print"success!"# this will not print since the condition results in 0
228
203
end
229
204
230
205
let foo =5
231
206
if foo
232
-
print("success!")
233
-
# This will print because the condition did not result in 0
207
+
print"success!"# this will print because the condition did not result in 0
234
208
end
235
209
236
210
let bar =""
237
211
if bar
238
-
print("success!")
239
-
# This will not print since the condition results in an empty string
212
+
print"success!"# this will not print since the condition results in an empty string
240
213
end
241
214
242
215
let bar ="i love this datapack"
243
216
if bar
244
-
print("success!")
245
-
# This will print since the condition did not result in an empty string
217
+
print"success!"# this will print since the condition did not result in an empty string
246
218
end
247
219
```
248
220
@@ -256,15 +228,13 @@ let foo = 7
256
228
let bar =5
257
229
258
230
if foo > bar
259
-
print("success")
260
-
# This will print since foo is greater than bar
231
+
print"success"# this will print since foo is greater than bar
261
232
end
262
233
263
234
let var ="hello, world"
264
235
265
236
if var ="goodbye, world"
266
-
print("success")
267
-
# This will not print since var is not "goodbye, world"
237
+
print"success"# this will not print since var is not "goodbye, world"
268
238
end
269
239
```
270
240
@@ -273,9 +243,8 @@ Strings and arrays have lengths, which can be compared against integers.
273
243
EX.
274
244
```ruby
275
245
let str ="hello"
276
-
# This will execute because the str of is less than ten
277
246
if str <10
278
-
print("Success!")
247
+
print"The length of the string is less than 10!"
279
248
end
280
249
```
281
250
@@ -288,25 +257,24 @@ They execute while a condition is met.
288
257
289
258
EX.
290
259
```ruby
260
+
# this will print the numbers 0-19
291
261
let i =0
292
-
# This will print the numbers 0-19
293
262
while i <20
294
-
print(i)
263
+
print i
295
264
let i = i +1
296
265
end
297
266
298
-
#This will run forever
267
+
#this will go on forever
299
268
while1
300
-
print("wheee!")
269
+
print"wheee!"
301
270
end
302
271
```
303
272
304
-
`N` loops execute a set number of times.
273
+
N loops execute a set number of times.
305
274
306
275
```ruby
307
-
# This will execute 10 times
308
276
loop10
309
-
print("Loop")
277
+
print"This will print 10 times"
310
278
end
311
279
```
312
280
@@ -318,8 +286,7 @@ The array can use variables or literals.
318
286
EX.
319
287
```ruby
320
288
let var =1
321
-
move(0, var, 0)
322
-
# The golem will jump up one block
289
+
move [0, var, 0] # the golem will jump up one block
323
290
```
324
291
325
292
## 8. Getblock
@@ -330,14 +297,11 @@ EX.
330
297
```ruby
331
298
let best_block ="minecraft:dirt"
332
299
333
-
getblock(0, -1, 0)
334
-
# The block under the golem is a dirt block in this example
335
-
print(BLOCK)
336
-
# This will print 'minecraft:dirt'
300
+
getblock [0, -1, 0] # the block under the golem is a dirt block in this example
301
+
printBLOCK# will print 'minecraft:dirt'
337
302
338
-
# This will execute because the block below is dirt
339
303
ifBLOCK= best_block
340
-
print("Yes, dirt is the best.")
304
+
print"Yes, dirt is the best."# this will print because the block below is dirt
341
305
end
342
306
```
343
307
@@ -349,10 +313,10 @@ The slot number is 0 indexed.
349
313
350
314
EX.
351
315
```ruby
352
-
#In slot 6, we have put a dirt block.
316
+
#in slot 6, we have put a dirt block.
353
317
354
-
place(5, [1,0, 1])
355
-
#This will place a dirt block diagonally to the
318
+
place5, [1,0,1]
319
+
#this will place a dirt block diagonally to the
356
320
# golem, provided there is not already a block there
357
321
```
358
322
@@ -361,10 +325,9 @@ The pickaxe will still lose durability.
361
325
362
326
EX.
363
327
```ruby
364
-
#In slot 7, we have an iron pickaxe.
328
+
#in slot 7, we have an iron pickaxe.
365
329
366
-
# This will mine the dirt block we placed earlier and take it back into the inventory.
367
-
place(6, [1, 0, 1])
330
+
place 6, [1,0,1] # this will mine the dirt block we placed earlier and take it back into the inventory.
368
331
```
369
332
370
333
If there is nothing in the slot, then nothing will happen.
@@ -376,9 +339,9 @@ It can be indexed like any other array.
376
339
377
340
EX.
378
341
```ruby
379
-
#If there is dirt in the first slot, print a message.
342
+
#if there is dirt in the first slot, print a message.
0 commit comments