File tree Expand file tree Collapse file tree 11 files changed +38
-30
lines changed
Expand file tree Collapse file tree 11 files changed +38
-30
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,11 @@ heading_anchors: true
77aux_links :
88 " SScript Repository " : " https://github.com/your-org/sscript"
99nav_sort : case_insensitive
10+
11+ # Syntax highlighting
12+ markdown : kramdown
13+ kramdown :
14+ syntax_highlighter : rouge
15+ syntax_highlighter_opts :
16+ line_numbers : false
17+ highlighter : rouge
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ Common fields:
4040
4141## Example
4242
43- ``` ss
43+ ``` python
4444on block_place(player, block):
4545 log player.name + " placed " + block.id + " at " + block.pos
4646end
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ parent: EN Home
88
99## Chat logger
1010
11- ``` ss
11+ ``` python
1212on player_chat(player, message):
1313 file_mkdirs(" sscripts/logs" )
1414 line = player.name + " : " + message + " \n "
1818
1919## Weather sync
2020
21- ``` ss
21+ ``` python
2222func sync_weather():
2323 headers = {
2424 " Accept" : " application/json" ,
4646
4747## Block placement reaction
4848
49- ``` ss
49+ ``` python
5050on block_place(player, block):
5151 run " tellraw " + player.name + " {\" text\" :\" Placed: " + block.id + " \" }"
5252end
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ parent: EN Home
1313
1414## 2. Minimal event script
1515
16- ``` ss
16+ ``` python
1717on player_join(player):
1818 log " Welcome " + player.name
1919end
2323
2424Define reusable functions at top-level:
2525
26- ``` ss
26+ ``` python
2727func hello(name):
2828 return " Hi " + name
2929end
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ parent: EN Home
1111- ` json_parse(text) `
1212- ` json_stringify(value) `
1313
14- ``` ss
14+ ``` python
1515obj = json_parse(" {\" ok\" :true}" )
1616log str (obj.ok)
1717```
@@ -29,7 +29,7 @@ Response object:
2929- ` headers `
3030- ` json `
3131
32- ``` ss
32+ ``` python
3333resp = http_get(" https://api.github.com" , {" Accept" :" application/json" }, 10 )
3434if resp.ok:
3535 log " status=" + str (resp.status)
4747- ` file_read_json(path) `
4848- ` file_write_json(path, value) `
4949
50- ``` ss
50+ ``` python
5151file_mkdirs(" sscripts/data" )
5252file_write_json(" sscripts/data/state.json" , {" online" : player_count()})
5353```
Original file line number Diff line number Diff line change @@ -8,15 +8,15 @@ parent: EN Home
88
99## Variables
1010
11- ``` ss
11+ ``` python
1212x = 10
1313name = " Steve"
1414ok = true
1515```
1616
1717## Conditions
1818
19- ``` ss
19+ ``` python
2020if x > 10 :
2121 log " big"
2222elif x == 10 :
2828
2929## Loops
3030
31- ``` ss
31+ ``` python
3232for i in range (1 , 5 ):
3333 log str (i)
3434end
4646- ` return `
4747- ` try/catch `
4848
49- ``` ss
49+ ``` python
5050try :
5151 run " say hi"
5252catch err:
5858
5959### List
6060
61- ``` ss
61+ ``` python
6262items = [" a" , " b" ]
6363items.add(" c" )
6464items.remove(1 )
6565```
6666
6767### Object
6868
69- ``` ss
69+ ``` python
7070obj = {" name" : " Alex" , " score" : 12 }
7171log obj.name
7272obj.score += 5
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ parent: RU Главная
4040
4141## Пример
4242
43- ``` ss
43+ ``` python
4444on block_place(player, block):
4545 log player.name + " поставил " + block.id + " в " + block.pos
4646end
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ parent: RU Главная
88
99## Лог чата
1010
11- ``` ss
11+ ``` python
1212on player_chat(player, message):
1313 file_mkdirs(" sscripts/logs" )
1414 line = player.name + " : " + message + " \n "
1818
1919## Синхронизация погоды
2020
21- ``` ss
21+ ``` python
2222func sync_weather():
2323 headers = {
2424 " Accept" : " application/json" ,
4646
4747## Реакция на установку блока
4848
49- ``` ss
49+ ``` python
5050on block_place(player, block):
5151 log player.name + " поставил " + block.id
5252end
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ parent: RU Главная
1313
1414## 2. Минимальный пример
1515
16- ``` ss
16+ ``` python
1717on player_join(player):
1818 log " Добро пожаловать, " + player.name
1919end
2323
2424Пиши переиспользуемые функции на верхнем уровне файла:
2525
26- ``` ss
26+ ``` python
2727func hello(name):
2828 return " Привет, " + name
2929end
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ parent: RU Главная
1111- ` json_parse(text) `
1212- ` json_stringify(value) `
1313
14- ``` ss
14+ ``` python
1515obj = json_parse(" {\" ok\" :true}" )
1616log str (obj.ok)
1717```
@@ -29,7 +29,7 @@ log str(obj.ok)
2929- ` headers `
3030- ` json `
3131
32- ``` ss
32+ ``` python
3333resp = http_get(" https://api.github.com" , {" Accept" :" application/json" }, 10 )
3434if resp.ok:
3535 log " status=" + str (resp.status)
4747- ` file_read_json(path) `
4848- ` file_write_json(path, value) `
4949
50- ``` ss
50+ ``` python
5151file_mkdirs(" sscripts/data" )
5252file_write_json(" sscripts/data/state.json" , {" online" : player_count()})
5353```
You can’t perform that action at this time.
0 commit comments