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
+88-50Lines changed: 88 additions & 50 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
83
+
By: xokz (Edited by RevolvingMadness)
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,55 +107,70 @@ let str = "Hello"
107
107
let x =1
108
108
let arr = [9, 2, -3, 6]
109
109
let var = ["hello", "world"]
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
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
113
116
let obj = {a:1,b:2+3}
114
117
```
115
118
116
119
Variables can be changed by simply redeclaring them.
117
120
118
121
EX.
119
122
```ruby
123
+
# 'foo' is now 7
120
124
let foo =7
121
-
let foo =8# foo is now 8 instead of 7
125
+
# 'foo' is now 8 instead of 7
126
+
let foo =8
122
127
```
123
128
124
129
Arrays can be added and removed from via addition and subtraction.
125
130
126
131
EX.
127
132
```ruby
128
133
let arr = [0, 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]
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]
132
141
```
133
142
134
143
Objects can be added and removed from via addition and subtraction.
135
144
136
145
EX.
137
146
```ruby
138
147
let obj = {a:1,b:2,c:3}
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}
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}
141
153
```
142
154
143
155
Strings can be added to with addition.
144
156
145
157
EX.
146
158
```ruby
147
159
let str ="hello"
148
-
print str # this will print 'hello'
160
+
print(str)
161
+
# This will print 'hello'
149
162
let var = str +", world!"
150
-
print var # this will print 'hello, world!'
163
+
print(var)
164
+
# This will print 'hello, world!'
151
165
```
152
166
153
167
Strings are just arrays of characters, so they can be indexed just like an array.
154
168
155
169
EX.
156
170
```ruby
157
171
let str ="hello, world!"
158
-
print str[1] # this will print 'e'
172
+
print(str[1])
173
+
# This will print 'e'
159
174
```
160
175
161
176
## 3. Printing
@@ -169,13 +184,20 @@ let bar = "xokz"
169
184
let arr = [0, 4, 7]
170
185
let obj = {hello:"world"}
171
186
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'
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'
179
201
```
180
202
181
203
## 4. Sleep
@@ -186,8 +208,10 @@ The provided value is how many ticks the golem will sleep for.
186
208
EX.
187
209
```ruby
188
210
let time =7
189
-
sleep time # sleep for 7 ticks
190
-
sleep40# sleep for 2 seconds, since 1 second is 20 ticks
211
+
# Sleep for 7 ticks
212
+
sleep time
213
+
# Sleep for 2 seconds, since 1 second is 20 ticks
214
+
sleep40
191
215
```
192
216
193
217
## 5. If Statements
@@ -199,22 +223,26 @@ EX.
199
223
```ruby
200
224
let foo =0
201
225
if foo
202
-
print"success!"# this will not print since the condition results in 0
226
+
print("success!")
227
+
# This will not print since the condition results in 0
203
228
end
204
229
205
230
let foo =5
206
231
if foo
207
-
print"success!"# this will print because the condition did not result in 0
232
+
print("success!")
233
+
# This will print because the condition did not result in 0
208
234
end
209
235
210
236
let bar =""
211
237
if bar
212
-
print"success!"# this will not print since the condition results in an empty string
238
+
print("success!")
239
+
# This will not print since the condition results in an empty string
213
240
end
214
241
215
242
let bar ="i love this datapack"
216
243
if bar
217
-
print"success!"# this will print since the condition did not result in an empty string
244
+
print("success!")
245
+
# This will print since the condition did not result in an empty string
218
246
end
219
247
```
220
248
@@ -228,13 +256,15 @@ let foo = 7
228
256
let bar =5
229
257
230
258
if foo > bar
231
-
print"success"# this will print since foo is greater than bar
259
+
print("success")
260
+
# This will print since foo is greater than bar
232
261
end
233
262
234
263
let var ="hello, world"
235
264
236
265
if var ="goodbye, world"
237
-
print"success"# this will not print since var is not "goodbye, world"
266
+
print("success")
267
+
# This will not print since var is not "goodbye, world"
238
268
end
239
269
```
240
270
@@ -243,8 +273,9 @@ Strings and arrays have lengths, which can be compared against integers.
243
273
EX.
244
274
```ruby
245
275
let str ="hello"
276
+
# This will execute because the str of is less than ten
246
277
if str <10
247
-
print"The length of the string is less than 10!"
278
+
print("Success!")
248
279
end
249
280
```
250
281
@@ -257,24 +288,25 @@ They execute while a condition is met.
257
288
258
289
EX.
259
290
```ruby
260
-
# this will print the numbers 0-19
261
291
let i =0
292
+
# This will print the numbers 0-19
262
293
while i <20
263
-
print i
294
+
print(i)
264
295
let i = i +1
265
296
end
266
297
267
-
#this will go on forever
298
+
#This will run forever
268
299
while1
269
-
print"wheee!"
300
+
print("wheee!")
270
301
end
271
302
```
272
303
273
-
N loops execute a set number of times.
304
+
`N` loops execute a set number of times.
274
305
275
306
```ruby
307
+
# This will execute 10 times
276
308
loop10
277
-
print"This will print 10 times"
309
+
print("Loop")
278
310
end
279
311
```
280
312
@@ -286,7 +318,8 @@ The array can use variables or literals.
286
318
EX.
287
319
```ruby
288
320
let var =1
289
-
move [0, var, 0] # the golem will jump up one block
321
+
move(0, var, 0)
322
+
# The golem will jump up one block
290
323
```
291
324
292
325
## 8. Getblock
@@ -297,11 +330,14 @@ EX.
297
330
```ruby
298
331
let best_block ="minecraft:dirt"
299
332
300
-
getblock [0, -1, 0] # the block under the golem is a dirt block in this example
301
-
printBLOCK# will print 'minecraft:dirt'
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'
302
337
338
+
# This will execute because the block below is dirt
303
339
ifBLOCK= best_block
304
-
print"Yes, dirt is the best."# this will print because the block below is dirt
340
+
print("Yes, dirt is the best.")
305
341
end
306
342
```
307
343
@@ -313,10 +349,10 @@ The slot number is 0 indexed.
313
349
314
350
EX.
315
351
```ruby
316
-
#in slot 6, we have put a dirt block.
352
+
#In slot 6, we have put a dirt block.
317
353
318
-
place5, [1,0,1]
319
-
#this will place a dirt block diagonally to the
354
+
place(5, [1,0, 1])
355
+
#This will place a dirt block diagonally to the
320
356
# golem, provided there is not already a block there
321
357
```
322
358
@@ -325,9 +361,10 @@ The pickaxe will still lose durability.
325
361
326
362
EX.
327
363
```ruby
328
-
#in slot 7, we have an iron pickaxe.
364
+
#In slot 7, we have an iron pickaxe.
329
365
330
-
place 6, [1,0,1] # this will mine the dirt block we placed earlier and take it back into the inventory.
366
+
# This will mine the dirt block we placed earlier and take it back into the inventory.
367
+
place(6, [1, 0, 1])
331
368
```
332
369
333
370
If there is nothing in the slot, then nothing will happen.
@@ -339,9 +376,9 @@ It can be indexed like any other array.
339
376
340
377
EX.
341
378
```ruby
342
-
#if there is dirt in the first slot, print a message.
379
+
#If there is dirt in the first slot, print a message.
0 commit comments