Command block: Difference between revisions

From Vintage Story Wiki
(created page outline)
 
(added video)
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
[[File:Commandblock.png|100px|thumb|Command block]]
[[File:Commandblock.png|100px|thumb|Command block]]
{{Keypress|Shift}}+{{RMB}} to edit, {{RMB}} to activate.
{{Keypress|Shift}}+{{RMB}} to edit, {{RMB}} to activate.
See [[List_of_server_commands]] for ideas of commands to trigger.  <br>
See [[List_of_server_commands]] for ideas of commands to trigger.  <br><br>
{{Messagebox
|title= Try it!
}}
<br>Example: {{Keypress|Shift}}+{{RMB}}, type <code>/announce Hello</code>, click {{Keypress|Save}} button.
<br>Example: {{Keypress|Shift}}+{{RMB}}, type <code>/announce Hello</code>, click {{Keypress|Save}} button.
{{RMB}} should result in <code>Hello</code> printing to the chat box.
{{RMB}} should result in <code>Hello</code> printing to the chat box.
Line 18: Line 21:
{{Keypress|Shift}}+{{RMB}} to edit, {{RMB}} to activate.
{{Keypress|Shift}}+{{RMB}} to edit, {{RMB}} to activate.
Connect a Command block to at least 1 side of a Conditional block.  On top of the Conditional block are small red and green boxes.  A command block on the side with the green box will activate when the condition is met; a command block on the side with the ''red'' box will activate when the condition is ''un''met.
Connect a Command block to at least 1 side of a Conditional block.  On top of the Conditional block are small red and green boxes.  A command block on the side with the green box will activate when the condition is met; a command block on the side with the ''red'' box will activate when the condition is ''un''met.
<br><br>Example: Place a conditional block such that the green box is on the side of the command block already configured to announce "Hello."  Place another command block on the side with the red box, and  {{Keypress|Shift}}+{{RMB}} to edit: type <code>/announce Bye</code>, click {{Keypress|Save}} button.
 
 
[[File:Conditional block closeup.png|left|100px|thumb]]
The conditional logic block only can test for entities.  Use either a player name or one of the following selection codes:
* s[] for self
* l[] for the entity currently looked at
* p[] for all players
* e[] for all entities
Inside the square brackets, one or more filters can be added, to be more selective. Filters include name, type, class, alive, range. For example, e[type=gazelle,range=3,alive=true].  The conditional block would register as true if a live gazelle comes within 3 blocks.
<br><br>
{{Messagebox
|title= Try it!
}}
Example: Place a conditional block such that the green box is on the side of the command block already configured to announce "Hello."  Place another command block on the side with the red box, and  {{Keypress|Shift}}+{{RMB}} to edit: type <code>/announce Bye</code>, click {{Keypress|Save}} button.
{{Keypress|Shift}}+{{RMB}} on the conditional block to edit: type <code>e[range=3]</code> to look for an entity within 3 blocks of the conditional block.
{{Keypress|Shift}}+{{RMB}} on the conditional block to edit: type <code>e[range=3]</code> to look for an entity within 3 blocks of the conditional block.
{{RMB}} on the conditional block should result in <code>Hello</code> printing to the chat box if the player is standing within 3 blocks of the conditional block, but result in <code>Bye</code> if the player is further than 3 blocks when activating the conditional block.
{{RMB}} on the conditional block should result in <code>Hello</code> printing to the chat box if the player is standing within 3 blocks of the conditional block, but result in <code>Bye</code> if the player is further than 3 blocks when activating the conditional block.


== Ticker block ==
== Ticker block ==
[[File:Tickerblock.png|100px|thumb|Ticker block]]
[[File:Tickerblock.png|100px|thumb|Ticker block]]
See [[ServerBlockTicking]] for an idea of what ticks are.
<br><br><br><br>
== Requires testing ==


The filters minx/miny/minz/maxx/maxy/maxz can also be used to specify a volume to search; coordinates are relative to the command caller's position.


Find the entity id by using .clientConfig showEntityDebuginfo. Useful for removing a specific trader permanently, for instance.
This argument may be omitted if the remainder of the command makes sense, in which case it will be interpreted as self.




Line 37: Line 60:
== Gallery ==
== Gallery ==
[[File:Conditional block closeup.png|thumb|alt=a view of the Conditional block showing true (green) and false (red) output directions|Conditional block closeup]]
[[File:Conditional block closeup.png|thumb|alt=a view of the Conditional block showing true (green) and false (red) output directions|Conditional block closeup]]
<br><br><br><br><br><br><br>








== Video tutorials ==


{| class="wikitable"
|-
! Entity range !!
|-
| <youtube width="400" height="240">tghtY44mbZY</youtube> ||
|}


== See also ==
== See also ==

Latest revision as of 12:00, 11 July 2024

This page was last verified for Vintage Story version 1.19.8.


UnderCon icon.png

This page is under construction.
This page is being created, or is in the process of extensive expansion or major restructuring. Until this notice is removed, please do not translate this page. Expect the content of this page to change significantly.


Obtaining

Command blocks are in the Special tab of the creative inventory. Access creative mode in a survival world via commands such as /gamemode creative.

Command block

Command block

Shift+Right mouse button to edit, Right mouse button to activate. See List_of_server_commands for ideas of commands to trigger.

Try it!


Example: Shift+Right mouse button, type /announce Hello, click Save button. Right mouse button should result in Hello printing to the chat box.


Conditional block

Conditional block

Shift+Right mouse button to edit, Right mouse button to activate. Connect a Command block to at least 1 side of a Conditional block. On top of the Conditional block are small red and green boxes. A command block on the side with the green box will activate when the condition is met; a command block on the side with the red box will activate when the condition is unmet.


Conditional block closeup.png

The conditional logic block only can test for entities. Use either a player name or one of the following selection codes:

  • s[] for self
  • l[] for the entity currently looked at
  • p[] for all players
  • e[] for all entities

Inside the square brackets, one or more filters can be added, to be more selective. Filters include name, type, class, alive, range. For example, e[type=gazelle,range=3,alive=true]. The conditional block would register as true if a live gazelle comes within 3 blocks.

Try it!

Example: Place a conditional block such that the green box is on the side of the command block already configured to announce "Hello." Place another command block on the side with the red box, and Shift+Right mouse button to edit: type /announce Bye, click Save button. Shift+Right mouse button on the conditional block to edit: type e[range=3] to look for an entity within 3 blocks of the conditional block. Right mouse button on the conditional block should result in Hello printing to the chat box if the player is standing within 3 blocks of the conditional block, but result in Bye if the player is further than 3 blocks when activating the conditional block.

Ticker block

Ticker block

See ServerBlockTicking for an idea of what ticks are.





Requires testing

The filters minx/miny/minz/maxx/maxy/maxz can also be used to specify a volume to search; coordinates are relative to the command caller's position.

Find the entity id by using .clientConfig showEntityDebuginfo. Useful for removing a specific trader permanently, for instance.

This argument may be omitted if the remainder of the command makes sense, in which case it will be interpreted as self.


History

Notes

Tyron posted "the conditional logic block only can test for entities right now and on success triggers an adjacent command block. green square side for true condition, red square side for false condition. the conditional block also needs triggering by the player or by an adjacent ticker block"

Gallery

a view of the Conditional block showing true (green) and false (red) output directions
Conditional block closeup













Video tutorials

Entity range

See also

References


Wiki Navigation
Vintage Story Guides[[::Category:Guides| ]]Frequently Asked Questions Soundtrack Versions Controls
Game systems Crafting Knapping Clay forming Smithing Cooking Temperature Hunger Mining Temporal stability Mechanical power Trading Farming Animal husbandry
World World generation Biomes Weather Temporal storms
Items Tools Weapons Armor Clothing Bags Materials Food
Blocks Terrain Plants Decorative Lighting Functional Ore
Entities Hostile entities Animals NPCs Players
Miscellaneous List of client commands List of server commands Creative Starter Guide Bot System WorldEdit Cinematic Camera Adjustable FPS Video Recording ServerBlockTicking