Forge Project

Total Miner Files are here and free

View on GitHub

Total Miner Scripting Command Example

A worked command-scripting example using the commands documented in the Scripting Command Reference.

This example uses an event-triggered reward shrine. Replace the placeholders with the values and syntax offered by the in-game script editor.


Table of contents


What This Example Does

This example demonstrates a small shrine encounter:

  1. The event checks whether the required block is present.
  2. The player receives a notification when the shrine is activated.
  3. A reward block is placed after a delay.
  4. A particle effect and sound provide feedback.
  5. An NPC can be spawned as a guardian.
  6. The event is assigned to a block with SetBlockScript.

The command names are used by the command-scripting system. Argument order and event-specific values must be confirmed in the in-game editor.

Basic Event Script

Start with a short action so you can verify that the event is connected correctly.

Notify("The shrine is active")

If the notification appears when the event runs, add the rest of the sequence one section at a time.

Check a Requirement

Use a condition before changing the world. The point and block arguments below are placeholders.

IsBlock(<shrine_point>, <required_block>)
	Notify("The shrine accepts the offering")
Else
	Notify("The shrine is missing its required block")
Endif

Keep the condition and its result together. This makes it easier to see what happens when the requirement is not met.

Build the Reward Sequence

Add a delay, place the reward block, and show visual and audio feedback.

IsBlock(<shrine_point>, <required_block>)
	Notify("The reward is charging")
	Wait(<delay>)
	SetBlock(<reward_point>, <reward_block>)
	Particle(<particle_effect>, <reward_point>)
	Sound(<sound_id>, <reward_point>)
Else
	Notify("The shrine is missing its required block")
Endif

The editor may require additional arguments for block auxiliary data, particle settings, or sound position. Use the editor’s command form rather than guessing those values.

Add an NPC Encounter

Once the basic reward works, add an NPC guardian.

NpcSpawn(<npc_type>, <guardian_point>)
NpcState(<npc>, <state>)

Test the NPC separately before adding it to the full event. This makes it easier to identify whether a problem comes from the event, the spawn position, or the NPC values.

Attach the Script

Attach the finished script to the event source. For a block-based shrine, use SetBlockScript.

SetBlockScript(<shrine_point>, "RewardShrineEvent")

For another event type, use the matching event command offered by the editor, such as SetEventScript where supported by that event.

Learning Notes

Sources


← Back to Scripting Documentation

← Back to Home