Total Miner Forums

Total Miner => Total Miner Discussion => Guides => Topic started by: muD on April 08, 2014, 11:20:39 AM

Title: [How to] Make Scripts
Post by: muD on April 08, 2014, 11:20:39 AM
Content:

What are Scripts? (#post_What)
Where can they be used? (#post_Where)
How are they used? (#post_How)

Change Log (#post_Log)

Command Lines (#post_clines)

Tutorials (#post_Tut1)

Aux (#post_Aux)
Tips (#post_Tips)
Extra Info (#post_Xtra)


________________________________________

What are Scripts?

Scripts are commands which can be executed to perform multiple repetitive tasks at the click of a button.
They are used to automatically perform a task which would otherwise need to be done manually.

A Script is made by the player & saved to the world.
Admins of the world have access to the Script Menu, from which they can manually select to edit or run any script at any time.

Scripts can also be triggered by using a Script Block, which when powered On or powered Off will execute any script which has been assigned to it.



Where can they be used?
 
Scripts can be used in all world types.
Creative mode has access to all the command lines which can be used in scripts.
Dig Deep & Survival modes have limited command lines available. -No commands which can fabricate objects into the world are available in these modes, for obvious reasons.



How are they used?

Below are some tutorials to show how to use the Change Log, how to create scripts, how to set up Script blocks, examples of some of the commands, and a list of all the Command Lines & their functions.


________________________________________


Change Log

You can access your Change Log by pressing Start, going to Player, then selecting Change Log.

As the admin you can view the Change Logs of all the players currently in your world.

The Change Log is a record of every physical change you have made in the world, upto the last 1000 changes; be it clearing a block, flicking a switch, pasting a component, or anything else that changes the physical state of the world.


Clearing your Change Log:

You can Clear your Change Log at any time by going to: Player > Change Log > and Pressing A to Clear.


When creating a new script you have the option to make a 'New Script From Change Log'
This will import all the data from your Change Log.



________________________________________


Tutorials

Tutorial 1

How to:
  • Use the Change Log
  • Make a script
  • Execute a script manually
  • Setup a Script Block
  • Execute a script automatically, using a switch


This is a nice easy first script to make; to help get used to how it all works.

Follow these steps to go through the above list while making a Hidden Doorway..


(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0013_zpsb43fbcc9.jpg)

This is where the hidden doorway will be.
We'll want a switch that will open the doorway when it is powered On, & to close again when it is powered Off.

_____________________

Start with the doorway open, as shown above.
The first thing to do now is access & clear your Change Log by pressing Start > going to 'Player' > 'Change Log' > Select your name > Then Press A to clear your Change log.

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0012_zpsfa4d7261.jpg)

_____________________


Now place the 2 blocks which will block the doorway

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0014_zpsefe49d3a.jpg)

_____________________


Go to the Creative menu (down on D-pad) > go to 'Scripts' > Select 'New Script from Change Log'

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0015_zps6673baad.jpg)

You should have just 2 lines of script;
1: AddBlock [coordinates] [Woodplank] [O ]
2: AddBlock [coordinates] [Woodplank] [O ]

if you have any more lines, press Y on them to delete them. Only the 2 AddBlock lines are needed.

Rename your script as you wish & select 'Save and Exit'

-You have made the script which will 'add' the blocks.

_____________________


Now we need to make the script to 'remove the blocks, to reveal your hidden doorway

Time to clear your Change Log again  -Go to 'Player > Change Log > Select your name > Clear Change Log.

_____________________


Break the 2 blocks which you placed in the previous step

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0013_zpsb43fbcc9.jpg)

Go to; Creative menu > Scripts > New Script from Change Log > Save and Exit

-You have made the script to ClearBlocks

_____________________


Lets test them to make sure they work before proceeding..

Go to: Creative Menu > Scripts > Run Script > Select your first script
-You should see the blocks added back into your wall.

And again go to; Creative Menu > Scripts > Run Script > Select your second script
-You should see the blocks removed from your wall.


Time to place a Script block & switch. Place these wherever you want them, anywhere in your world.
I will just place them here;

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0017_zps15dc6e9b.jpg)

Press Y then A on the Script block to enter the Setup for it.

When the Script block is powered On i want the doorway to open, so i will select my second script for this - The one which is set to ClearBlocks

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0020_zpsfee0ac3b.jpg)

When powered Off i want it to add the blocks, covering the passageway - so i will select my first script for this;

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0021_zpsa043a984.jpg)

Done.
The hidden doorway will now open when the switch is On & close when it is Off.


________________________________________



Tutorial 2

How to:
  • Locate the coordinates of a block
  • Manually insert & edit a command line
  • Make a script without using the Change Log

Follow these steps to go through the above list while making a AddInventory script.

This time we won't use the Change Log. Commands will be inserted & edited manually.

In this tutorial we will set this chest to have a stick added to it every time a player walks over a pressure plate.


To do this we will need the coordinates of the inventory we want to add to
-The chest in this example here is at [555,201,614]

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0022_zps4c21ee1c.jpg)
Coordinates are displayed at the top right of the information window of all blocks. Press Y on any block to see its coordinates.
_______________

Go to Creative Menu > Scripts > New Script

Go down to the command lines & press Right on the D-pad to 'Insert Command'

Select 'AddInventory' then delete the line with 'nop' in it - this is not needed.

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0024_zpse9b7b3f9.jpg)

Edit the AddInventory command line by pressing A on it

You will now be able to edit the details of the script

Add the coordinates of the chest, the item you want added & quantity;

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0025_zps6d9c18ea.jpg)

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0026_zps78e3258b.jpg)

Save & Exit.
Your AddInventory script is done.
Now time to make the switch which activates it.

I want a pressure plate to activate my script so i will place a script block with a pressure plate on top here;

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0027_zps6ee0c34f.jpg)

I will now go into the Script block setup & select my AddInventory script when it is powered On;

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0028_zps47a79865.jpg)


That is all that is needed to make an AddInventory script.
You got the coordinates, made a new script, added & edited a command line to make an AddInventory script
..Now a stick will now be added to that chest whenever someone walks on that pressure plate.


________________________________________



Tutorial 3

How to:
  • Notify players
  • Use delays
  • Setup a Script Block to act as a pressure plate


Here we will make a script to display a message to new players arriving in the world.
-Delays will also be used to give players time to read each message.

For this we will need just a new script & script blocks to act as pressure plate.

_______________________

First thing to do is make the script;
Creative Menu > Scripts > New Script

Go down to line '1: nop' & press Right to Insert Command

Select Notify then press A to edit the command line
-i will edit my first notification to be globally displayed and say 'Welcome to the world'

like so;
(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0033_zps2abf508d.jpg)
(change local to global)
_______________________

Now i want a delay before the next message is displayed
-To do this, move to line 2 and Insert a Wait command

I want the delay to be about 2 seconds so i will edit the Wait command to Wait [2000]

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0035_zps89327596.jpg)

-Here I have inserted a total of 3 Wait commands & 4 Notify commands into one script.

_______________________

I want this notification to trigger after players have loaded into the world & have moved out the spawn
-I will use the script blocks option to act as a pressure plate for this.

First I will place a script block and set it to run the Welcome script when powered On - & Act as pressure plate, like so;
(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0036_zps5c49de94.jpg)

I'll then copy and paste that script block around the spawn block, like so;

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0037_zpsf50ed419.jpg)

Note, the textures can be changed on script blocks.

That is all for this. It is done.
Now whenever someone walks over those script blocks, they will receive the Welcome messages

*Note* Everyone in the world will receive the notification. there is currently no way to limit the messages to zones or admins.

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0040_zpsc7a605de.jpg)
_________________

Other useful Global messages include;
Notifying players before shutting the server down.
Notifying players of events about to start or open.
Notifying players of new rules, admins, winners ect
Other information regarding your world



________________________________________



Tutorial 4

How to:
  • Paste a component by script
  • Reset the area (ClearRegion)


The easiest way is to first Clear your Changelog > Load the component you wish to paste > Paste it using the copytype you wish > Create new script from Change Log

I'll go through those steps in more detail below:
_________________

I'll have a bridge pasted across here when this button is pressed

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0105_zpsb7e9c466.jpg)

_________________

Clear your Changelog  (Start > Player > Options > Change Log > Clear Change Log)

Load the component you wish to paste & paste it how & where you wish

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0106_zps5780cbb4.jpg)

_________________

Create a new script from ChangLog, rename it as you wish.

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0107_zpse07bc5de.jpg)

*Note* Make sure your command line is pasting a component from a component pack & not from your clipboard.
If you copy an area then paste it, your command line will say [clipboard] & it will paste whatever is currently saved in your clipboard -which is no good for this purpose.
Make sure to Save or Load the Component before pasting & creating your script.

_________________

So i've pasted the component & created the new script.. now i want the bridge to be removed when i power another button the other side of the bridge.

In this scenario it's easiest for me to just use a ClearRegion script to remove the bridge.

I'll place my Markers > clear my Change Log > Creative clear the area > (make any other edits you require to reset the area) > Create new script from Change Log.

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0108_zpsfd3ef5bb.jpg)

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0109_zpsa6244762.jpg)



________________________________________



Command Lines

See Script Command Documentation (http://totalminerforums.net/index.php?topic=7721.msg91537#msg91537) for a full, updated list of all the commands & their functions in 2.1

The list below is valid until that release as the format has changed and everything you need to know regarding Command Lines for your scripts can be found in the link above. goc


AddBlock [x,y,z] [block] [aux] 
-[x,y,z] specifies the location the block will be added
-[block] defines which block-type will be placed
-[aux] is used to determine which direction the block will be facing (This does not need to be included or used)
See AUX section below for more info on placing blocks in a particular direction.


AddInventory  [x,y,z] [item] [qty] 
-[x,y,z] specifies which storage unit to act upon.
-[item] defines which item or block to add.
-[qty] determines how many items will be added. The quantity.
*Note* Non-stackable items require a separate command line for each item.


ClearBlock [x,y,z]
Will clear the block at the [x,y,z] position


ClearInventory [x,y,z]
Will clear the entire inventory of any specified Crate, Chest, Locked Chest, Safe, Turret, Book Case or Economised Shop at the [x,y,z] location


ClearRegion [x,y,z] [x,y,z] [percent]
-[x,y,z] defines one corner of the region to be cleared.
-[x,y,z] defines the opposite corner of the region to be cleared.
The region can contain upto 500,000 blocks.
-[percent] determines how much percentage of the area to clear.  (This does not need to be included or used. The default value is 100%)


Comment
Is used by scriptmakers to make notes in the script itself.
They have no effect on the script or world.


Commit
Is used to force a graphics refresh. Normally the game will refresh the graphics after a script has run through its commands and completed.


CopyBlock [x,y,z] [x,y,z]
-[x,y,z] specifies the block to be copied.
-[x,y,z] determines the position the block will be copied to.


CopyRegion [x,y,z] [x,y,z] [x,y,z]
-[x,y,z] defines one corner of the region to copy.
-[x,y,z] defines the opposite corner of the region to copy.
-[x,y,z] determines the position the region will be copied to. The lowest coordinate of the copied region will be placed at this position.
The copied region will be facing the same direction as the area it was copied.
Regions can contain upto 500,000 blocks.



FillRegion [x,y,z] [x,y,z] [block]
-[x,y,z] defines one corner of the region to be filled
-[x,y,z] defines the opposite corner of the region to be filled
-[block] determines which blocktype will be used to fill the region


Fog [x,y,z] [radius] [duration] [intensity] [r,g,b] [visibility]
-[x,y,z] defines the central coordinate of the area to be affected by fog.
-[radius] determines how many blocks in each direction the fog will spread from [x,y,z].
-[duration] defines how many seconds the fog will be visible.
-[intensity] determines the Intensity of the fog. (1=lowest value/thinnest fog)(10=highest value/thickest fog)
-[r,g,b] defines the Red, Green and Blue color values of the fog.
-[visibility] defines the distance (in blocks) that the fog effect extends for, from the players viewpoint.

[x,z] - the y parameter can also be included for convenience, but is ignored. e.g. [100,200,25] and [100,25] are equivalent.
[intensity] is now a %, so valid values are 1 - 100.
The [visibility] parameter defines the distance (in blocks) that the fog effect extends for, from the players viewpoint (eyes). Valid values are 2 - 100. For Fog that has an intensity of 100%, this defines the distance the player can see before the Fog becomes an impenetrable wall. If the intensity is < 100%, the player will be able to see the fog effect start to drop off again after the distance defined by [visibility]. The formula used to calculate the distance is FarClip - ((FarClip - FogVisibility) * FogIntensity), where FarClip is the players view distance in blocks, FogVisibility is the total visibility of all the stacked fog effects the player is currently positioned inside, and FogIntensity is the total intensity of all the stacked fog effects the player is currently positioned inside.
Both color [r,g,b] and [visibility] are optional parameters (they can be omitted). If these parameters are omitted, the values used are [115+/-r,115+/-r,115+/-r] for color (where r is a random number between 0 - 25, and [50] for visibility.

-Craig

-Use an RGB color picker (http://www.rapidtables.com/web/color/RGB_Color.htm) to get values.
*NOTE*  Multiple Fog scripts can be stacked upto a total intensity value of 10.
Command is not available until v2.04

info Video here (https://www.youtube.com/watch?feature=player_embedded&v=tbQ6Z2--TYM)


Marker [name] [delete|x,z] [admin]
-[name] defines the existing map marker to act upon, or names a new map marker.
-[delete|x,z] is used to delete an existing marker, or define the position of a new map marker.
-[admin] determines whether the map marker is visible only to admins.
*NOTE* Command is not available until v2.04


MoveBlock [x,y,z] [x,y,z]
-[x,y,z] defines the block to be moved
-[x,y,z] determines the position the block will be moved to
*Note* Moved storage units retain their inventory 


MoveRegion [x,y,z] [x,y,z] [x,y,z]
-[x,y,z] defines one corner of the region to be moved.
-[x,y,z] defines the opposite corner of the region to be moved.
-[x,y,z] determines the position the region will be moved to. The lowest coordinate of the copied region will be placed at this position.
Regions can contain upto 500,000 blocks.


Notify [message] [local|global]
This command will display custom notifications on the screen.
-[message] enter the text you want to display.
-[local] will display the notification only on the host machine.
-[global] will display the notification to all players in the world.


Paste [pack:component] [x,y,z] [facing] [copytype]
-[pack:component] enter the name of the component pack & the component you wish to paste.
-[x,y,z] defines the position the lowest coordinate of the component will be pasted.
-[facing] determines the direction it will be pasted. (see AUX for more info)
-[copytype] determines the paste method used, use either; [Overwrite] [NoOverwrite] or [Merge]


Rain [x,y,z] [radius] [duration] [intensity] [0,0,0]
-[x,y,z] defines the central coordinate of the area to be affected by rain.
-[radius] determines how many blocks in each direction the rain will spread from [x,y,z].
-[duration] defines how many seconds the rain will fall.
-[intensity] determines the intensity of the rain. (1=lowest value/lightest rain)(10=highest value/heaviest rain)
-[0,0,0] defines the RGB color value of the rain.

-Use an RGB color picker (http://www.rapidtables.com/web/color/RGB_Color.htm) to get values.
*NOTE*  Multiple Rain scripts can be stacked upto a total intensity value of 10.
Command is not available until v2.04

info Video here (https://www.youtube.com/watch?feature=player_embedded&v=tbQ6Z2--TYM)


ReplaceRegion [x,y,z] [x,y,z] [block1] [block2]
This is used to replace the blocks in an area; like the 'Replace' creative tool.
-[x,y,z] defines one corner of the region
-[x,y,z] defines the opposite corner of the region
-[block1] defines which blocktype will be replaced
-[block2] determines which blocktype will be used to replace


Script [name]
This is used to run another script.
-[name] defines which script to run


SetPower [x,y,z] [on|off]
-[x,y,z] defines which block will be acted upon
-[on] sets power On
-[off] sets power Off


SetSwitch [x,y,z] [on|off|toggle]
-[x,y,z] defines which switch to act upon
-[on] sets switch On
-[off] sets switch Off
-[toggle] sets switch to its opposite state.


SpawnMob [x,y,z] [mobtype]
-[x,y,z] determines the location the mob will be spawned
-[mobtype] defines which mob will spawn


Spawnable mobs:
-Goblin
-Spider
-Zombie
-Dryad
-Djinn
-Orc
-Diablo
-Warewolf
-TrollChief
-Duck
-Sheep
-Alpaca
-AyrshireCow
-HighlandCow


Teleport [x,y,z] [x,y,z] [x,y,z] [absolute|relative]
-[x,y,z] defines one corner of the region to be teleported From
-[x,y,z] defines the opposite corner of the region to be teleported From
-[x,y,z] determines the location to be teleported To
-[absolute] players will be teleported to [x,y,z]
-[relative] players will be teleported to [x,y,z] + their position relative to the lowest coordinate of [x,y,z] [x,y,z]
(e.g. if player was 2 blocks South-East from the lowest coordinate in the 'teleport-From' region; they will be teleported 2 blocks South-East of [x,y,z])


Texture [x,y,z] [id]
-[x,y,z] defines the block to act upon
-[id] selects which texture to use
(Insert a number into the [id] parameter. The number used will correspond to the list of textures you have already chosen for that block type to use.
[1] will be the first texture selected After the default texture in the list
[15] will be the last texture in the list of possible textures for that block-type
[ 0] will be the default texture for the block type)

-consider using a 'Commit' command after changing textures to ensure the graphics refresh



Wait [milliseconds]
This command is used to make a script wait, or halt, for a specified amount of time before continuing on to its following command lines.
-[milliseconds] determines how long the script will wait before proceeding.
1000 milliseconds = 1 second


Waypoint [delete|x,y]
-[delete|x,y] determines whether the existing waypoint is deleted, or the location the new waypoint is placed on the map.
*NOTE* Command is not available until v2.04


Zone [name] [delete] [x,y,z] [x,y,z] [edit=on|off] [pvp=on|off] [fly=on|off] [mobs=on|off] [script=name]
-[name] defines the Zone to act upon, or names a new Zone.
-[delete] is used to delete the zone -(Remove this parameter if you do not wish to delete the zone)
-[x,y,z] defines one corner of the region to make a new zone.
-[x,y,z] defines the opposite corner of the region to make a new zone. -(Remove or ignore these parameters if you do not wish to make a new zone)
-[edit=on|off]
-[pvp=on|off]
-[fly=on|off]
-[mobs=on|off] these are used to toggle the zones settings
-[script=name] sets a script to be triggered when players enter the zone.



Optional Parameters

[qty], [percent], [aux], [facing], [copytype], [on.off.toggle]

All these parameters should be optional on the command line. If omitted (not used), the game uses a default value.

defaults:
[qty] = 1
[percent] = 100
[aux] = 0
[facing] = left
[copytype] = overwrite
[on.off.toggle] = toggle
[local.global] = local



________________________________________



Aux

This parameter is used to determine the direction, or position a block is placed

0 = Facing East, 1 = Facing South, 2 = Facing West, 3 = Facing North.

If the parameter is omitted it will use the default value: 0
   
_______________________

Aux Data - Auxiliary data

Every block in the map has 8 bits of data available to it called auxiliary data.

Bits 1 - 3 are used for orientation and state.

Bit 4 is used to store whether or not the block is the originally generated block or whether it has been changed since generation (by a player or something else). This bit cannot be manipulated by script commands.

Bits 5 - 8 are used to store the selected texture id's (value range = 0-15 = 16 possible textures).

In order to calculate the Aux values by hand, you must understand the binary number system and how to form separate values in different groups of bits and combine them to calculate the final number.

http://en.wikipedia.org/wiki/Binary_number
http://en.wikipedia.org/wiki/Bitwise_operation
http://en.wikipedia.org/wiki/Bit_manipulation
http://en.wikipedia.org/wiki/Bit_field
http://en.wikipedia.org/wiki/Mask_%28computing%29

-----------------------------------------------------------------------------------------

Any block that has orientation: doors, trapdoors, stairs, ramps, one way glass, paintings, climbing ivy, torches, ladders, switches, buttons, beds, cylinders, use Bits 1 - 3 to define their orientation.


The following blocks can only face NSEW. They use Bits 1 and 2 to define the direction they face. A value from 0 to 3 inclusive. 0 = Facing East, 1 = Facing South, 2 = Facing West, 3 = Facing North.

Doors
Trapdoors
Stairs
Ramps
OneWayGlass
Beds
Cylinders

Cylinders are slightly different in that if Bit 3 = 0, then they are upright and Bits 1 - 2 are ignored. If Bit 3 = 1, then they are horizontal and Bits 1 - 2 are used to define their orientation.

Doors and Trapdoors use Bit 3 to define their state. 0 = Closed, 1 = Open.


The following blocks can be attached to the face of another block. They use Bits 1 - 3 to define the face they are attached to. A value from 0 to 5 inclusive. 0 = East face, 1 = South face, 2 = West face, 3 = North face, 4 = Top face, 5 = Bottom face.

ClimbingIvy
Switches
Buttons
Ladders
Torches
Paintings

Ladders and ClimbingIvy cannot be attached to the top or bottom face, so they cannot have a value higher than 3.

Torches cannot be attached to the bottom face, so they cannot have a value higher than 4.

Paintings are slightly different. They use Bits 1 - 2 to define the NSEW face they are attached to, but if Bit 3 = 1, then they are attached to the top face of the other block, facing up, and Bits 1 - 2 are now used to define their orientation.

Half Block:
Only uses Bit 1. If Bit 1 = 0, they are grounded, if Bit 1 = 1, they are raised.

Shops.
If Bit 1 = 1 they are economized.

Crops:
Bits 1 - 3 are used to define their current growth stage. Values 0 - 5 (6 stages).
Bits 5 - 8 are used to define the crop. Current values 0 - 2 (Wheat, Sugar Cane, Tomato).

Keys:
Bits 1 - 3 and 5 - 8 are used to define the key id.
0 = Skeleton key, 1 = Skull key. It's tricky to work this out by hand because Bit 4 is not used.

---------------------------------------------------------------------------

Textures

All blocks that can have their textures changed, including Paintings, use bits 5 - 8 of their Aux data to define the slot id for their texture.

0 = Default
1 - 15 = The slot id. That is the slot on the texture selection screen, not the block id itself.

e.g. If for Stairs you had Default, ConcreteBrick, WoodPlank, LimeStone and Glass selected as your textures, then a value of 3 will cause the stairs to be drawn with the LimeStone texture.



________________________________________



Tips


You can change the texture of Script Blocks & Buttons

You can find the coordinates of any block by prospecting it (pressing Y on it) - The coordinates are displayed in the top right of the information window.

When you prospect a block, its coordinates are copied & you can paste them into your scripts command lines by pressing LT

Scripts can run other scripts


Add Inventory:
Adding multiple instances:
The [1] parameter at the end of the command line determines the amount of items added by the script.
To add more than 1 item or block, modify the [1] parameter found at the end of the command line.

________________

Non-Stackable Items:
Adding items to an inventory which do not stack; such as weapons, tools, armour, or anything that requires 1 inventory slot per item will require a separate command line to add each item.

Example:  To add 2 swords to a chest you will need 2 command lines, each one placing a sword.
Example: 
1: AddInventory [xyz] [woodensword] [1]
2: AddInventory [xyz] [woodensword] [1]
______________

Note:
You cannot add to the inventory of players.


Command line for adding Gold Coins

AddInventory [x,y,z] [goldpieces] [1]

[3200000] is the maximum gold pieces a chest can hold - that is 3 million, 2 hundred thousand.
If you use a number too high, such as 9999999999 it will revert to default, only adding 1.



________________________________________



Extra Info

You cannot execute the same script more than once at the same time.
e.g. if you have circuitry which causes a script to be executed while it is already executing (from some other input), the circuit will ignore the script and continue.
This limitation was put in place to stop unexpected results for both the player and the game.

-Craig

https://www.youtube.com/watch?feature=player_embedded&v=zOTPE-vOoF8



________________________________________


If you have any questions, feel free to ask.

Also, check out:

[How to]  Make Scripts (http://totalminerforums.net/index.php?topic=5426.msg67607#msg67607)

[How to]  Backup your Game Data (http://totalminerforums.net/index.php?topic=6390.msg75693#msg75693)

[How to]  Use Zones & Permissions (http://totalminerforums.net/index.php?topic=6380.msg75596#msg75596)

[How to]  Make Circuits & Logic Gates (http://totalminerforums.net/index.php?topic=5710.msg69707#msg69707)

[How to]  Copy, Paste & Save Components (http://totalminerforums.net/index.php?topic=476.msg5381#msg5381)

[How to]  Use Books - Editing & Management (http://totalminerforums.net/index.php?topic=4996.msg61749#msg61749)
Title: Re: Scripts -[How to]-
Post by: .ok on April 08, 2014, 12:02:45 PM

if there was a way you could make a vids/s that would help alot of ppl more

i can learn alot better visually instead of reading..but thats just me :P
Title: Re: Scripts -[How to]-
Post by: muD on April 08, 2014, 12:07:32 PM
if there was a way you could make a vids/s that would help alot of ppl more

i can learn alot better visually instead of reading..but thats just me :P
yes it would be a lot easier for you & me both. I'll look into it.

please could you edit your post and remove the quote. it's really long


OP updated, AddInventory script added.
Title: Re: Scripts -[How to]-
Post by: .ok on April 08, 2014, 12:33:53 PM
yes it would be a lot easier for you & me both. I'll look into it.

please could you edit your post and remove the quote. it's really long


OP updated, AddInventory script added.
sorry :p
Title: Re: Scripts -[How to]-
Post by: Marianek9 on April 08, 2014, 01:15:16 PM
muD, very helpfull post, thanks! :)
Title: Re: Scripts -[How to]-
Post by: DHGStealPackage on April 08, 2014, 01:23:06 PM
All of this will be edited & updated while i build up this guide of how to make basic scripts.

Following these steps should give a good enough understanding of how the change log & script blocks work

If there is any thing in particular you want to know how to do regarding scripts, feel free to ask


_____________________

Add / Remove blocks

In this example i'll make a Hidden Doorway 

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0013_zpsb43fbcc9.jpg)

This is where i want the hidden doorway.
I want a switch that will open the doorway when it is Powered On.

_____________________

I have my wall with the doorway open, as shown above.
The first thing to do now is 'Press Start > go to 'Player' > 'Change Log' > Select your name > Then Press A to clear your Change log

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0012_zpsfa4d7261.jpg)

_____________________


Now place the 2 blocks which will block the doorway

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0014_zpsefe49d3a.jpg)

_____________________


Go to the Creative menu (down on D-pad) > go to 'Scripts' > Select 'New Script from Change Log'

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0015_zps6673baad.jpg)

You should have just 2 lines of script;
1: AddBlock [xxx,xxx,xxx] [Woodplank] [O ]
2: AddBlock [xxx,xxx,xxx] [Woodplank] [O ]

if you have any more lines, press Y on them to delete them. Only the 2 AddBlock lines are needed.

Now Select 'Save and Exit'  -(Rename the script as you wish)

You have just made the script which will 'add' the blocks to hide your hidden doorway

_____________________


Now we need to make the script to 'remove the blocks, to reveal your hidden doorway

Time to clear your Change Log again  -Go to 'Player > Change Log > Select your name > Clear Change Log

_____________________


Break the 2 blocks which you placed in the previous step

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0013_zpsb43fbcc9.jpg)

Go to; Creative menu > Scripts > New Script from Change Log > Save and Exit

you have just created the script to remove those blocks

_____________________


Lets test them to make sure before proceeding..

Go to: Creative Menu > Scripts > Run Script > Select your first script
You should see the blocks added back into your wall.

And again go to; Creative Menu > Scripts > Run Script > Select your second script
You should see the blocks removed from your wall.

Ok, all good so far..
Time to place the Script block & switch. Place these wherever you want them
I will just place them here;

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0017_zps15dc6e9b.jpg)

Press Y then A on the Script block to enter the setup for it.

When the Script block is Powered On i want the doorway to open, so i will select my second script for this - The one which is set to Clear Blocks

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0020_zpsfee0ac3b.jpg)

When Powered Off i want it to add the blocks, covering the passageway - so i will select my first script for this;

(http://i349.photobucket.com/albums/q377/Berrgk/TMF/Photo0021_zpsa043a984.jpg)

That is all that is needed for a simple Add/Remove script, using the Change Log

________________________


Add Inventory

This time we won't use the Change Log.

I want this chest to have a stick added to it every time a player walks over a pressure plate - so i can know how many times my hidden passageway has been accessed.

First thing to do is note the coordinates of the inventory you want to add to - The chest in this example here is at [555,201,614]

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0022_zps4c21ee1c.jpg)
_______________

Go to Creative Menu > Scripts > New Script

Go down to the command lines & press Right on the D-pad to 'Insert Command'

Select 'AddInventory' then delete the line with 'nop' in it - this is not needed.

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0024_zpse9b7b3f9.jpg)

Edit the AddInventory command by pressing A on it

You will now be able to edit the details of the script
I will add the coordinates of my chest, the item i want added & quantity;

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0025_zps6d9c18ea.jpg)

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0026_zps78e3258b.jpg)

Save & Exit.
Your AddInventory script is done. Now time to make the switch which activates it.

I want a pressure plate to activate my script so i will place a script block with a pressure plate on top here;

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0027_zps6ee0c34f.jpg)

I will now go into the Script block setup & select my AddInventory script when it is Powered On;

(http://i349.photobucket.com/albums/q377/Berrgk/Photo0028_zps47a79865.jpg)

That is all that is needed to make an AddInventory script.
A stick will now be added to that chest whenever someone walks on that pressure plate.

That should give a good enough understanding of the basics & necessary methods for later going on to produce complicated circuits.

______________________

To do;
Move Block
Copy / Move / Replace / Clear Region
Comment / Commit / Notify
Set Power / Set Switch / Spawn Mob
Paste / Texture
Wait / Script


I tend to use the place and remove region commands. It keeps the script shorter and easier to read.
Title: Re: Scripts -[How to]-
Post by: muD on April 08, 2014, 01:40:37 PM
I tend to use the place and remove region commands. It keeps the script shorter and easier to read.
I will add examples of all the commands
the 2 so far should be enough info on the most relevant functions for now; change log, script blocks, switches, editing command lines ect

really impressed with the way Craig has designed all the Ui & options for it.. the change log is so useful
Title: Re: Scripts -[How to]-
Post by: Jaz on April 08, 2014, 02:38:42 PM
when you first start a command it says "nop" what does this mean?
Title: Re: Scripts -[How to]-
Post by: SwiftGeneration on April 08, 2014, 03:34:59 PM
when you first start a command it says "nop" what does this mean?

Nigel's Overgrown Pram
;)
Title: Re: Scripts -[How to]-
Post by: .ok on April 08, 2014, 06:32:50 PM
i was messing around w the inventory part and i gugured a way to fill all of the what was crates now chests with max gold
because previouslu when i build that arcade i had crates and what i ended up was filling all 100-200 crates that were under the arcade blocks with gold to the max amount you could add or 65K x 20
and that took 6 hrs to do

now i have or will have it to where when smne walks in or out of the arcade they step on 1 of 2 pressure plates that fills the current 2 chests i have in fromt until i open the map later where i can punch in each of the chests xyz

but now ill never have to worry about ppl taking more gold than they need or worry about finding each chest that has gold missing & filling those spots up
Title: Re: Scripts -[How to]-
Post by: .ok on April 08, 2014, 06:44:12 PM
i also came up with a really awesome and complicated idea
but if i wanna even attempt it i need to know

is there a way to run multiple scripts at once
is there a way to time the commands
can you delay say script a for like 5 seconds....then the moment a gets delayed to have a timer on b or c where they perform a command after....like how a redstone repeater has 3 delays...would it be possible for if u flick a swich script a would be on tick 4,script b ould be on tick 3 and script c would be on tick 2 or 1 and have them perform their task bfr either meeting back together or waiting to perform on another comand

if ur able to understand my idea and its possible
then h4dhhg33696giugw356ttyyyyutxst
Title: Re: Scripts -[How to]-
Post by: muD on April 08, 2014, 07:35:37 PM
i also came up with a really awesome and complicated idea
but if i wanna even attempt it i need to know

is there a way to run multiple scripts at once
is there a way to time the commands
can you delay say script a for like 5 seconds....then the moment a gets delayed to have a timer on b or c where they perform a command after....like how a redstone repeater has 3 delays...would it be possible for if u flick a swich script a would be on tick 4,script b ould be on tick 3 and script c would be on tick 2 or 1 and have them perform their task bfr either meeting back together or waiting to perform on another comand

if ur able to understand my idea and its possible
then h4dhhg33696giugw356ttyyyyutxst
all sounds do-able
sounds like you could use just one script block & put delays in it for that. may be easier.
check out the Wait command - you will want to use Wait [5000] for a 5 second delay

For example;
1: Wait [5000]
2: SetPower [x,y,z] [on]
3: Wait [4000]
4: SetSwitch [x,y,z] [on]
5: Wait [3000]
6: SpawnMob [x,y,z] [sheep]

& yes you can also run scripts from scripts - or have simultaneous scripts to run
7: Script [name]

i'll make a thing for OP on delays & running scripts from scripts sometime. maybe tomoz

whatever you had in mind, it sounds possible
Title: Re: Scripts -[How to]-
Post by: bob on April 08, 2014, 07:43:57 PM
Once again, great topic. Thanks for writing it up. Well deserving of a sticky
Title: Re: Scripts -[How to]-
Post by: muD on April 08, 2014, 07:46:17 PM
i was messing around w the inventory part and i gugured a way to fill all of the what was crates now chests with max gold
because previouslu when i build that arcade i had crates and what i ended up was filling all 100-200 crates that were under the arcade blocks with gold to the max amount you could add or 65K x 20
and that took 6 hrs to do

now i have or will have it to where when smne walks in or out of the arcade they step on 1 of 2 pressure plates that fills the current 2 chests i have in fromt until i open the map later where i can punch in each of the chests xyz

but now ill never have to worry about ppl taking more gold than they need or worry about finding each chest that has gold missing & filling those spots up

:) cool
have you used an 'add/remove block' script to make the arcade players safe from interference yet?
sure they'd all appreciate it

see some plans for that & other ideas here http://totalminerforums.net/index.php?topic=4807.msg58749#msg58749
Title: Re: Scripts -[How to]-
Post by: muD on April 08, 2014, 07:48:52 PM
Once again, great topic. Thanks for writing it up. Well deserving of a sticky
no worries :) thanks bob
Title: Re: Scripts -[How to]-
Post by: .ok on April 08, 2014, 10:08:15 PM
:) cool
have you used an 'add/remove block' script to make the arcade players safe from interference yet?
sure they'd all appreciate it

see some plans for that & other ideas here http://totalminerforums.net/index.php?topic=4807.msg58749#msg58749
what do u mean?im confused
Title: Re: Scripts -[How to]-
Post by: muD on April 08, 2014, 10:20:55 PM
what do u mean?im confused
(http://i349.photobucket.com/albums/q377/Berrgk/TMF/arcade_zps8e2fd3b3.jpg)
Title: Re: Scripts -[How to]-
Post by: stewydeadmike on April 08, 2014, 10:49:15 PM
thanks all my chests can be full so I dont have to constantly refill them  :D
Title: Re: Scripts -[How to]-
Post by: Pringle on April 08, 2014, 11:26:24 PM
This topic just completly thought me it all
Title: Re: Scripts -[How to]-
Post by: Littleman9Mew2 on April 09, 2014, 12:18:26 AM
hey muD, you should add a section for the wireless transmitter and receiver blocks.
could help alot for some of those inventive people!
and maybe add something about component pasting!
Title: Re: Scripts -[How to]-
Post by: muD on April 09, 2014, 01:25:37 AM
hey muD, you should add a section for the wireless transmitter and receiver blocks.
could help alot for some of those inventive people!
and maybe add something about component pasting!
Yup, will get to them
______

section for Delays & Notifications added to OP
Title: Re: Scripts -[How to]-
Post by: Powerlord on April 09, 2014, 01:32:00 AM
Interesting guide, should help newcomers a lot.
Title: Re: Scripts -[How to]-
Post by: The Gold Knight on April 09, 2014, 02:16:39 AM
Question: In the notify script, what does the local/global part of the script do?
Title: Re: Scripts -[How to]-
Post by: muD on April 09, 2014, 02:37:28 AM
Question: In the notify script, what does the local/global part of the script do?
I don't know.
I presume Local limits the notifications to within a certain distance of either the script block or admin running it.. & Global will notify everyone in the world but that is guesswork.
i tried testing in local split-screen but notifications pop up regardless of distance, which was expected..
Required 2 people on separate machines to find the distance a local notification was sent, if that is what it is..
i also want to find out
Title: Re: -=[How to]=- Make Scripts
Post by: Jaz on April 09, 2014, 03:38:24 AM
Once again, great topic. Thanks for writing it up. Well deserving of a sticky
i agree with Bob, this is one of my favourite topics if not it is my fav :D XD
Title: Re: -=[How to]=- Make Scripts
Post by: Tom on April 09, 2014, 05:40:51 AM
Question for you Mud,  any look creating a Looping Scripts? . So far attempts have failed :P either I'm messing up somewhere along the line or they aren't designed for to loop.
Title: Re: -=[How to]=- Make Scripts
Post by: The White Rabbit on April 09, 2014, 05:47:10 AM
Question for you Mud,  any look creating a Looping Scripts? . So far attempts have failed :P either I'm messing up somewhere along the line or they aren't designed for to loop.

I tried that however it failed badly so I just created a script of copy and paste so much that I simply lost the will to work on it xD
Title: Re: -=[How to]=- Make Scripts
Post by: Tom on April 09, 2014, 05:53:11 AM
I tried that however it failed badly so I just created a script of copy and paste so much that I simply lost the will to work on it xD
I tried bypassing Script [name] function because that didn't allow for looping by using a circuit but it would not repower the script. For some reason it will not execute the script again, without physically flicking the switch of the original script block. I'm gonna try script commands to see if I can get it to work.
Title: Re: -=[How to]=- Make Scripts
Post by: The White Rabbit on April 09, 2014, 05:55:50 AM
I was working with script commands and kept drawing blanks and I really need this loop to make my airships fly in the distance :(
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 09, 2014, 07:45:37 AM
Question for you Mud,  any look creating a Looping Scripts? . So far attempts have failed :P either I'm messing up somewhere along the line or they aren't designed for to loop.
Yes I have made a couple of looping scripts, but there is a mech in place to stop recursive scripts

Quote from: Craig
I've also added a Script [scriptName] command, which allows you to execute another script inside a script. This allows you to write modular scripts, with each one doing only a specific task, and then you can call them as you need them (string them together) allowing for primitive script reuse.

Note the Script command will cause nested execution. The SetSwitch command also has the potential to do this, because the switch may activate another script as part of it's circuit.

In order to stop both excessive ram use and infinitely recursing scripts (script A calls script B which calls script A which calls script B), there is a limit of 20 nested scripts. Once the nested limit is reached, a script cannot execute another script (directly or indirectly) so eventually the nested scripts will unwind.
Source (http://totalminerforums.net/index.php?topic=4807.msg58930#msg58930)

can make simple loopers like so;

1: Script [1]
2: Commit
3: Wait [1000]
4: Script [2]
5: Commit
6: Wait [1000]
7: Script [1]
8: Commit
9: Wait [1000]
10: Script [2]
11: Commit

repeat as necessary, but there is a limit then it can't be looped by switches, buttons, scripts or anything.. will need a manual reboot if no one can find a way round it
Title: Re: -=[How to]=- Make Scripts
Post by: ANTHONY 7357 on April 09, 2014, 08:57:43 AM
Thank you so much for making this guide. I would have never figured out how to even refill a chest using scripts without it.
Title: Re: -=[How to]=- Make Scripts
Post by: DHGStealPackage on April 09, 2014, 09:23:45 AM
Yes I have made a couple of looping scripts, but there is a mech in place to stop recursive scripts
Source (http://totalminerforums.net/index.php?topic=4807.msg58930#msg58930)

can make simple loopers like so;

1: Script [1]
2: Commit
3: Wait [1000]
4: Script [2]
5: Commit
6: Wait [1000]
7: Script [1]
8: Commit
9: Wait [1000]
10: Script [2]
11: Commit

repeat as necessary, but there is a limit then it can't be looped by switches, buttons, scripts or anything.. will need a manual reboot if no one can find a way round it

Tried this, but didn't have "Commit". What does it do? (It didn't work obviously...) :P
Title: Re: -=[How to]=- Make Scripts
Post by: Keaton Potatoes on April 09, 2014, 09:25:21 AM
Thanks you sooooooo much I was so lost  ::) Most helpful script guide I have seen (Granted I haven't seen very many :P)
Title: Re: -=[How to]=- Make Scripts
Post by: Tom on April 09, 2014, 09:53:19 AM
Yes I have made a couple of looping scripts, but there is a mech in place to stop recursive scripts
Source (http://totalminerforums.net/index.php?topic=4807.msg58930#msg58930)

can make simple loopers like so;

1: Script [1]
2: Commit
3: Wait [1000]
4: Script [2]
5: Commit
6: Wait [1000]
7: Script [1]
8: Commit
9: Wait [1000]
10: Script [2]
11: Commit

repeat as necessary, but there is a limit then it can't be looped by switches, buttons, scripts or anything.. will need a manual reboot if no one can find a way round it

I had a feeling there was a mechanism in place to stop it, For what I was trying to do, it would have been looped infinitely and To do it I will just settle for a Manual reboot in the form of a button. Thanks for the Help thought :).
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 09, 2014, 10:02:32 AM
No worries fellas. Remember, if there is anything in particular you wanna see, know or need help with, we'll try an help when we can. feel free to post..


Tried this, but didn't have "Commit". What does it do? (It didn't work obviously...) :P
Quote from: Craig
Commit is used to force a graphics refresh, basically allowing a primitive form of animation during the execution of the script.

If the game forced a graphics refresh after every command, the scripts would run quite slow because graphics refreshes are slow. So the game doesn't do that, it just executes all the commands and causes a graphics refresh at the end.

This would usually be the desired behaviour anyway. If you have a bunch of add block and clear block commands to build up a structure, you probably don't want to see each block being added and cleared (animation), you just want to see the final result at the end (no animation).

However if you do want to see the animation, the commit command is provided to give you that option. It would normally be used in tandem with the wait command to create a slight delay between each animation.

I used it in each step of the looping script test to make sure i could see the removal & addition of the blocks on every action.

it's more demanding but was essential for seeing every animate move of the script

Note, while that demanding looping script was running, any other script i tried to run had noticeably increased load times
Title: Re: -=[How to]=- Make Scripts
Post by: stewydeadmike on April 09, 2014, 10:30:15 AM
I found a problem when trying to make a sword spawn in chest but when
I tested it it said item unrecongized and didn't spawn in the chest how do I fix this  :!
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 09, 2014, 10:57:34 AM
I found a problem when trying to make a sword spawn in chest but when
I tested it it said item unrecongized and didn't spawn in the chest how do I fix this  :!
I just tested & works ok
Your problem is probably a typo - Make sure to use no capital letters or spaces in the command line item or block names.

You'll need a command line for each sword you want added - probably the case for all items which don't stack..

To add 5 swords to your chest, you will need something like this;
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]

-changing the 1 has no effect it will add one sword at a time.
Make one command line then just copy it however many times needed to get the right amount of swords.
Can also double them up by setting a script block to run the script when powered On & Off

To fill a chest with swords you could copy the AddInventory command line 25 times into the script, then set a script block to run that script when a button powers On, & again when the button powers off.. = 50 swords added. Full chest.
k?
Title: Re: -=[How to]=- Make Scripts
Post by: stewydeadmike on April 09, 2014, 11:10:22 AM
I just tested & works ok
Your problem is probably a typo - Make sure to use no capital letters or spaces in the command line item or block names.

You'll need a command line for each sword you want added - probably the case for all items which don't stack..

To add 5 swords to your chest, you will need something like this;
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]

-changing the 1 has no effect it will add one sword at a time.
Make one command line then just copy it however many times needed to get the right amount of swords.
Can also double them up by setting a script block to run the script when powered On & Off

To fill a chest with swords you could copy the AddInventory command line 25 times into the script, then set a script block to run that script when a button powers On, & again when the button powers off.. = 50 swords added. Full chest.
k?
oooooohhhhh *facepalm* I had a space in it  :P but thanks now I know I need a separate command to add all the swords
Title: Re: -=[How to]=- Make Scripts
Post by: DHGStealPackage on April 09, 2014, 11:44:28 AM
No worries fellas. Remember, if there is anything in particular you wanna see, know or need help with, we'll try an help when we can. feel free to post..


I used it in each step of the looping script test to make sure i could see the removal & addition of the blocks on every action.

it's more demanding but was essential for seeing every animate move of the script

Note, while that demanding looping script was running, any other script i tried to run had noticeably increased load times

Thank you so much! So my scripts were working i just couldn't see it?
Title: Re: -=[How to]=- Make Scripts
Post by: Michaelc9 on April 09, 2014, 05:28:52 PM
When writing a script, I do not understand what is meant by the commands 'comment', 'commit' or 'texture'.
Everything else I understand, and I continue to develop more complicated scripts, but I'd like to know what these mean if somebody would please enlighten me.
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 09, 2014, 05:47:17 PM
I just tested & works ok
Your problem is probably a typo - Make sure to use no capital letters or spaces in the command line item or block names.

You'll need a command line for each sword you want added - probably the case for all items which don't stack..

To add 5 swords to your chest, you will need something like this;
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]
AddInventory [coordinates] [steelsword] [1]

-changing the 1 has no effect it will add one sword at a time.
Make one command line then just copy it however many times needed to get the right amount of swords.
Can also double them up by setting a script block to run the script when powered On & Off

To fill a chest with swords you could copy the AddInventory command line 25 times into the script, then set a script block to run that script when a button powers On, & again when the button powers off.. = 50 swords added. Full chest.
k?
wrong :p
i actually used GoldPieces
and it still filled the chests
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 09, 2014, 05:48:24 PM
mud did you check your messages?i mped you
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 09, 2014, 05:52:17 PM
and a q i was wondering about bfr i try and out :P
 is
Is there a way to set the script to run at a specific time
and/or day/night or both

and then ive heard about ppl being able to make npc move around
how do you do that/or quests
Title: Re: -=[How to]=- Make Scripts
Post by: Littleman9Mew2 on April 09, 2014, 06:50:24 PM
buD, its me again, what is the aux command on placeblock for?

placeblock [x,y,z] [name] [aux]
Title: Re: -=[How to]=- Make Scripts
Post by: DHGStealPackage on April 09, 2014, 07:12:42 PM
buD, its me again, what is the aux command on placeblock for?

placeblock [x,y,z] [name] [aux]

[Aux] Is for when you place a directional item. This number determines how the block is placed (ex. switches on the side of blocks etc.) . for most things, its "0" but it's different for stuff like switches and such.
Title: Re: -=[How to]=- Make Scripts
Post by: W1CK3DM80 on April 10, 2014, 06:38:52 AM
hey is there a way where i can set notify for one person to see and the rest cant? if so how? it only gives Local and Global option, im not sure if the notify script is able to do that?
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 10, 2014, 10:34:05 AM
and a q i was wondering about bfr i try and out :P
 is
Is there a way to set the script to run at a specific time
and/or day/night or both

and then ive heard about ppl being able to make npc move around
how do you do that/or quests
No, there is not a good way to set scripts to run at particular times of the day at present. You will have to manually run them.
The Sundial was problematic, it may be added properly in a future update.

Probably best to make NPCs move around using a move/commit/wait/move/commit script.

wrong :p
i actually used GoldPieces
and it still filled the chests
That post you quoted was about how to add multiple non-stackable items to an inventory.
Gold pieces are stackable.

Thank you so much! So my scripts were working i just couldn't see it?
That's probably the case, yes.

hey is there a way where i can set notify for one person to see and the rest cant? if so how? it only gives Local and Global option, im not sure if the notify script is able to do that?
I don't think that is possible & it would be useful. Perhaps should be brought up in the Ideas section.
I'd like to see parameters such as: [admins|global|range|gamertag;gamertag]
for admins only - everyone in the world - a set range from the block or admin running the script - specific gamertags

When writing a script, I do not understand what is meant by the commands 'comment', 'commit' or 'texture'.
Everything else I understand, and I continue to develop more complicated scripts, but I'd like to know what these mean if somebody would please enlighten me.

I have updated the OP to include info about every command. it should answer your questions
Title: Re: -=[How to]=- Make Scripts
Post by: Gary on April 11, 2014, 06:49:48 PM
Wow. I actually understand scripts now!
Title: Re: -=[How to]=- Make Scripts
Post by: urlag on April 11, 2014, 09:09:40 PM
Hi mud,  so I finally got round to downloading 2.0 tonight and had a play with the scripts.  First off thank you for this topic.  So helpful getting me started. 
Now I'm looking to paste a  script block (with it's own script) from a first script block. Haven't been able to figure it out yet so if you or anyone else could shine some light on how to do this it would be much appreciated
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 11, 2014, 09:20:07 PM
Hi mud,  so I finally got round to downloading 2.0 tonight and had a play with the scripts.  First off thank you for this topic.  So helpful getting me started. 
Now I'm looking to paste a  script block (with it's own script) from a first script block. Haven't been able to figure it out yet so if you or anyone else could shine some light on how to do this it would be much appreciated
no worries bud.

Sounds like you need to first make the script which script block 2 will run, then set a script block to use that script when powered on, & Save it as a component.

Then in your other script, the one that runs first & pastes the second; Command it to paste the component (the saved script block) & SetPower on
k?

edit: sry if that is too vague, i'll be more specific if necessary tomoz, need to sleep now tho
Title: Re: -=[How to]=- Make Scripts
Post by: Littleman9Mew2 on April 11, 2014, 11:37:49 PM
Discovered something with the moveblock script, if you move a chest from point A to point B, and activate the script WHILE its still at point B it get deleted!

Guessing it's moving air to the same spot :P
Title: Re: -=[How to]=- Make Scripts
Post by: Craig on April 12, 2014, 12:14:47 AM
correct
Title: Re: -=[How to]=- Make Scripts
Post by: urlag on April 12, 2014, 03:30:53 AM
no worries bud.

Sounds like you need to first make the script which script block 2 will run, then set a script block to use that script when powered on, & Save it as a component.

Then in your other script, the one that runs first & pastes the second; Command it to paste the component (the saved script block) & SetPower on
k?

edit: sry if that is too vague, i'll be more specific if necessary tomoz, need to sleep now tho
  your discription was fine thanks.  I was nearly there but didn't think about using a script component. 
On that note though I just did as above and got a code 4 :(
It seems this bug is already reported though. 
Title: Re: -=[How to]=- Make Scripts
Post by: Craig on April 12, 2014, 06:51:58 AM
There appears to be a problem with Notify [text] [local/global]

Local is only supposed to show the message on the local xbox (to local players) and global is supposed to show the message to all xboxes (all players) on the session. But of course (duh) scripts are run on all xboxes, so all players see even local messages. I'll try fix that in the patch.
Title: Re: -=[How to]=- Make Scripts
Post by: Craig on April 12, 2014, 07:49:07 AM
Regarding case, all parameters should be case insensitive, that is, it should not matter if you use upper case letters (capital letters) or lower case letters. This includes the command itself, blocks, items and option parameters.
Title: Re: -=[How to]=- Make Scripts
Post by: Craig on April 12, 2014, 08:04:51 AM
Regarding optional parameters.

eg. [qty], [percent], [aux], [facing], [copytype], [on.off.toggle].

All these parameters should be optional on the command line. If omitted, the game uses a default value.

defaults:
[qty] = 1
[percent] = 100
[aux] = 0
[facing] = left
[copytype] = overwrite
[on.off.toggle] = toggle
[local.global] = local
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 12, 2014, 11:58:48 AM
hey craig
do uk if its possible for a time option to be added in the scripts for day/night/anytime
so things would appear or happen like powered lights turning on at night when it gets dark or anything else really
or maybe if its even possible
to have a option to see the current in game time
if it is then would that make the time option more doable?
beds run on the current in game time so thats why i was wondering
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 12, 2014, 08:42:34 PM
Regarding optional parameters.

[qty], [percent], [aux], [facing], [copytype], [on.off.toggle]

Thanks for the info. added to op

Could you explain the [aux] & [facing] commands plz?
What are the values relative to?)
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 13, 2014, 10:51:24 AM
  your discription was fine thanks.  I was nearly there but didn't think about using a script component. 
On that note though I just did as above and got a code 4 :(
It seems this bug is already reported though.
oh dear..
another method would be to have 'script block 2' moved into position by script1, where it will receive power and activate.
This bypasses the need to save a component & paste. A lot easier, & will not code 4 ; )
Title: Re: -=[How to]=- Make Scripts
Post by: Scarzy on April 13, 2014, 11:56:38 AM
Is it just me or is the paste command not working?
I've read how to use it.

And I put the co ordinates it right and made it face [up]
And made it [overwrite]
But when I press test script it says
"Defaulted to overwrite"
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 13, 2014, 12:45:36 PM
Is it just me or is the paste command not working?
I've read how to use it.

And I put the co ordinates it right and made it face [up]
And made it [overwrite]
But when I press test script it says
"Defaulted to overwrite"
yeh i reported this already. here (http://totalminerforums.net/index.php?topic=5577.msg68766#msg68766)
Title: Re: -=[How to]=- Make Scripts
Post by: Scarzy on April 14, 2014, 04:47:38 PM
For some reason, the percent command in clear region doesn't work.
Is it bugged or am I doing something wrong?
Title: Re: -=[How to]=- Make Scripts
Post by: Peacebringer on April 14, 2014, 09:33:29 PM
How do u Fill regions in Survival? It works in Creative but not Surv.
Title: Re: -=[How to]=- Make Scripts
Post by: Peacebringer on April 14, 2014, 09:53:16 PM
For some reason, the percent command in clear region doesn't work.
Is it bugged or am I doing something wrong?
Its not working for me either.
Title: Re: -=[How to]=- Make Scripts
Post by: Scarzy on April 14, 2014, 11:45:36 PM
How do u Fill regions in Survival? It works in Creative but not Surv.
You cannot. Because you can fill a region of titanium, and boom unlimited titanium.
Title: Re: -=[How to]=- Make Scripts
Post by: ZlewisajaxZ on April 15, 2014, 02:05:39 PM
Is there a way to create a script witch whenever somebody's completed a course on a challenge map they can just simply go over to a box and type in the code and it will automatically write their name in the hall of fame.Instead of msging the host for him/her to do it.
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 15, 2014, 06:30:48 PM
nope
and thats called lazyness upon your behalf

theres a script to make a custom notification for say when they finish it
but thats it
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 15, 2014, 09:34:54 PM
ik its broke atm but is there a way to say

you have a grid
where a & b are ground level and c/d are below them
or

AB
CD

A is stationary

what i want to do after the patch is
make C dissapear/cleared
D to move to B
C moved to D

Then powered off
D moved to C
B moved to D
and cover B back w the prev block

i tried moving region but there was 3 xyz comands so i got confused on that

i  want a way where the script on ground level that deletes the staircase

bcs i have 1 script atop where when u form the staircase it adds it
then the bottom one on ground level maakes it dissapear

im trying to find a way where its less ovious or so theres not a script on the ground where if ppl keep walking over it that they keep activating it
i could add a comand to add a button on a script i have by it bt thatd be ugly and/or most ppl wouldnt know to push a button

or i could notify them

but is thee a simple way to do it w the current scripts?
Title: Re: -=[How to]=- Make Scripts
Post by: Scarzy on April 16, 2014, 02:29:14 AM
ik its broke atm but is there a way to say

you have a grid
where a & b are ground level and c/d are below them
or

AB
CD

A is stationary

what i want to do after the patch is
make C dissapear/cleared
D to move to B
C moved to D

Then powered off
D moved to C
B moved to D
and cover B back w the prev block

i tried moving region but there was 3 xyz comands so i got confused on that

i  want a way where the script on ground level that deletes the staircase

bcs i have 1 script atop where when u form the staircase it adds it
then the bottom one on ground level maakes it dissapear

im trying to find a way where its less ovious or so theres not a script on the ground where if ppl keep walking over it that they keep activating it
i could add a comand to add a button on a script i have by it bt thatd be ugly and/or most ppl wouldnt know to push a button

or i could notify them

but is thee a simple way to do it w the current scripts?
I was lost after first line.
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 16, 2014, 05:06:08 AM
Is there a way to create a script witch whenever somebody's completed a course on a challenge map they can just simply go over to a box and type in the code and it will automatically write their name in the hall of fame.Instead of msging the host for him/her to do it.
There is not a way to do that.

I could inform you of a way for your players to be able to write their own name in a book at the end of a challenge then have the book transferred to your Admin HQ, but there is not a way of making it grief-proof. Players could (& therefore will) intentionally mess it up; so that method is not worth using.

However, I would recommend using Books to record your 'Hall of Fame' data instead of using signs on walls.
For example, in my world I use a 'Book of Heroes' to record all who have passed each challenge.
I am able to add names to them very quickly without having to leave my Admin HQ.

This also means I can place the recorded data (multiple books) anywhere, such as before & after a challenge, & the 'Hall of Fame' does not require me to go there to add each name on a sign..
The sign-on-wall method gives obvious disadvantages such as potentially running out of space, & not being able to have multiple instances of the records placed around your world as efficiently.

See my thread on -=How to=- Books [Editing & Management] (http://totalminerforums.net/index.php?topic=4996.msg61749#msg61749) for more info on how to do that.
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 16, 2014, 05:45:14 AM
ik its broke atm but is there a way to say

you have a grid
where a & b are ground level and c/d are below them
or

AB
CD

A is stationary

what i want to do after the patch is
make C dissapear/cleared
D to move to B
C moved to D

Then powered off
D moved to C
B moved to D
and cover B back w the prev block

i tried moving region but there was 3 xyz comands so i got confused on that

i  want a way where the script on ground level that deletes the staircase

bcs i have 1 script atop where when u form the staircase it adds it
then the bottom one on ground level maakes it dissapear

im trying to find a way where its less ovious or so theres not a script on the ground where if ppl keep walking over it that they keep activating it
i could add a comand to add a button on a script i have by it bt thatd be ugly and/or most ppl wouldnt know to push a button

or i could notify them

but is thee a simple way to do it w the current scripts?

Yes that can all be done now, don't need to wait for the patch.

& yes, there is a much simpler way to make a staircase disappear/reappear.

1: Clear Change Log > Build your staircase > Save new script from change log
2: Clear Change Log > Destroy staircase > Save new script from change log

3: Set your script block at the top of the stairs to run script 1 when powered On
4: Set your script block at the bottom of the stairs to run script 2 when powered On

use the 'Act as pressure plate' to have it done automatically, so players do not have to press anything.

k?
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 16, 2014, 07:52:09 PM
Yes that can all be done now, don't need to wait for the patch.

& yes, there is a much simpler way to make a staircase disappear/reappear.

1: Clear Change Log > Build your staircase > Save new script from change log
2: Clear Change Log > Destroy staircase > Save new script from change log

3: Set your script block at the top of the stairs to run script 1 when powered On
4: Set your script block at the bottom of the stairs to run script 2 when powered On

use the 'Act as pressure plate' to have it done automatically, so players do not have to press anything.

k?
im not asking about the staircase itself bcs thats all done

i was asking about the scripts
script 1 calls the staircase
script 2 on the ground deletes it
but what i wanna do is find a way where 2 is more hidden bcs its out in the main lobby/in the open and my only fear is that when ppl keep steping over it theyll cause the script to activate causing it to be in use and using 1 of 3 background threads/create lag in the game
 w/o me even knowing
so thats y i wanted to make it hidden
or like my plan for the 3rd script
where when activated
the 3rd script comes up a block to ground level where you step on it(this being after the stairs was gone)
and it adds  the button atop and whatever else for next use
then powered off it goes back down and another block covers that.....keeping it hidden

think of it as a reset

but thats where im stuck at for now
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 17, 2014, 08:10:19 PM
im not asking about the staircase itself bcs thats all done

i was asking about the scripts
script 1 calls the staircase
script 2 on the ground deletes it
but what i wanna do is find a way where 2 is more hidden bcs its out in the main lobby/in the open and my only fear is that when ppl keep steping over it theyll cause the script to activate causing it to be in use and using 1 of 3 background threads/create lag in the game
 w/o me even knowing
so thats y i wanted to make it hidden
or like my plan for the 3rd script
where when activated
the 3rd script comes up a block to ground level where you step on it(this being after the stairs was gone)
and it adds  the button atop and whatever else for next use
then powered off it goes back down and another block covers that.....keeping it hidden

think of it as a reset

but thats where im stuck at for now
can you explain exactly what you want like this;
No stairs > player walks on block > stairs appear > block to add stairs is hidden > Player goes upstairs > Stairs are removed?...

i'm unclear of the effect you want. can you not just move the script block down 1 & add a block ontop to cover it while you don't want people activating it, then just have it moved up 1 when you do want it trigger-able?

_______________

Updated OP & added info about AUX command
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 17, 2014, 08:45:38 PM
can you explain exactly what you want like this;
No stairs > player walks on block > stairs appear > block to add stairs is hidden > Player goes upstairs > Stairs are removed?...

i'm unclear of the effect you want. can you not just move the script block down 1 & add a block ontop to cover it while you don't want people activating it, then just have it moved up 1 when you do want it trigger-able?

_______________

Updated OP & added info about AUX command
correct on the last part
and i mean this for when youre on the ground where you want it to go away
the 1st script which is in a room above that has a button that calls the stairs out
once that script begins the button also dissapears so ppl dont spam it

the 2nd script that makes the staircase go away is the ground
and its uncovered or that part is activated when u push the button up top

and theres a barrier around it so others dont go on it while u come down

then when u walk on the 2nd script the stairs go away and then powered off would add a button back uptop and the blocks would cover back up
thats where
can you explain exactly what you want like this;
No stairs > player walks on block > stairs appear > block to add stairs is hidden > Player goes upstairs > Stairs are removed?...

i'm unclear of the effect you want. can you not just move the script block down 1 & add a block ontop to cover it while you don't want people activating it, then just have it moved up 1 when you do want it trigger-able?

_______________

Updated OP & added info about AUX command
comes into play
like a reset
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 17, 2014, 09:07:17 PM
correct on the last part
and i mean this for when youre on the ground where you want it to go away
the 1st script which is in a room above that has a button that calls the stairs out
once that script begins the button also dissapears so ppl dont spam it

the 2nd script that makes the staircase go away is the ground
and its uncovered or that part is activated when u push the button up top

and theres a barrier around it so others dont go on it while u come down

then when u walk on the 2nd script the stairs go away and then powered off would add a button back uptop and the blocks would cover back up
thats wherecomes into play
like a reset

Script 1: (for script block 1 powered on)
1: Clear block (button)
3: Add blocks (barrier where you want it)
2: Add blocks (stairs)
4: Move block (script block 2 raised one block to be accessible)

Script 2: (for script block 2 powered on)
1: Clear blocks (stairs & barrier)
2: Add block (button)

Script 3: (for script block 2 powered off)
1: Move block (script block 2 lowered one)
2: Add block (to cover script block 2)


ok?
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 17, 2014, 09:33:34 PM
Script 1:
1: Add blocks (stairs)
2: Clear block (button)
3: Add blocks (barrier where you want it)
4: Move block (script block 2 raised one block to be accessible)

Script 2:
1: Clear blocks (stairs & barrier)
2: Add block (button)
3: Move block (script block 2 lowered one)
4: Add block (to cover script block 2)

ok?
thats pretty much what im doing almost

the only problem though is the move script is actually broken where it also clears the block as well

that was the biggest prob
but now after 2.0.1 ill be fine
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 17, 2014, 09:37:29 PM
thats pretty much what im doing almost

the only problem though is the move script is actually broken where it also clears the block as well

that was the biggest prob
but now after 2.0.1 ill be fine
i edited my post for a better method
the move block isnt a prob. just add a block on top script block 2 after its moved down
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 17, 2014, 10:41:45 PM
i edited my post for a better method
the move block isnt a prob. just add a block on top script block 2 after its moved down
That's what I tried and I guess it kept removing the block for me
So I guess ill just have to wait until the morning :p
Title: Re: -=[How to]=- Make Scripts
Post by: RensBestFriend on April 18, 2014, 02:01:37 PM
Hey thx for this post its very helpful. Also ive been reading a topic about making an elevator,and I was wondering if you could make a how to on that if you dont mind, a how to video.^^
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 18, 2014, 03:19:53 PM
Hey thx for this post its very helpful. Also ive been reading a topic about making an elevator,and I was wondering if you could make a how to on that if you dont mind, a how to video.^^
You're welcome..

An 'elevator' can't actually be done, it would break the games laws of physics ^^  A platform which declines in sequential steps can tho, which is what you've probably seen.
a MoveRegion > Wait > MoveRegion > Wait command ;repeat; can be used to do that. or lots of addblock/clearblock scripts
but yup will add info on things like moving / pasting / turning regions ect when i can
Title: Re: -=[How to]=- Make Scripts
Post by: RensBestFriend on April 19, 2014, 03:35:58 PM
You're welcome..

An 'elevator' can't actually be done, it would break the games laws of physics ^^  A platform which declines in sequential steps can tho, which is what you've probably seen.
a MoveRegion > Wait > MoveRegion > Wait command ;repeat; can be used to do that. or lots of addblock/clearblock scripts
but yup will add info on things like moving / pasting / turning regions ect when i can
  thank you once more for the advice ^^
Title: Re: -=[How to]=- Make Scripts
Post by: xRobJD on April 26, 2014, 03:07:26 PM
Can anyone tell me what the commit script is used for?
Title: Re: -=[How to]=- Make Scripts
Post by: Clerical on April 26, 2014, 03:08:50 PM
Can anyone tell me what the commit script is used for?
From muD

Commit:
Is used to force a graphics refresh. Normally the game will refresh the graphics after a script has run through its commands and completed. This command can be necessary if you want to see parts of the 'animated change.
Use sparingly as it does demand the processing of the graphics. Overusing this feature will result in delayed processes elsewhere.
Title: Re: -=[How to]=- Make Scripts
Post by: xRobJD on April 26, 2014, 03:14:33 PM
What does the commit script do?
Title: Re: -=[How to]=- Make Scripts
Post by: Clerical on April 26, 2014, 03:18:54 PM
What i quoted is what the commit script does.
Many people will not understand or have a use for it
Title: Re: -=[How to]=- Make Scripts
Post by: .ok on April 30, 2014, 07:30:12 AM
so some qs/things i noticed....

on my stair script....even though i have comits in the script,the txtures on my stairs dont update that texture...but it worked fine bfr i opened my map online?

is there any way w scripts or circuits to make like a code or theres a specific order that you have to push via burttons for something to happen...say like a door or something
i had another q but cant remember it atm

Title: Re: -=[How to]=- Make Scripts
Post by: Dauntless395 on April 30, 2014, 10:30:51 AM
So I had a question regarding the use of [aux] in script commands.

My scenario is that I want a giant block door to "swing outwards" by using the move region command. Basically door pointing east-west will rotate 90 degrees to face north-south.

Would the [aux] command be used to make the blocks face a new direction?
Or will I have to move the east-west door piece away and move in the north-south one, to make the illusion that the blocks change directions?

I tried using it, but it didn't change the direction that the door would face. Im starting to think maybe the [aux] would only change the direction that direction-sensitive blocks (one way glass, ramps, stairs) in the move region would change, not the direction of the entire region itself.



Also as a general note, using the "move region" command to an area of the map that hasnt rendered will cause it to vaporize from the map. For example, I move my blocks down to an inconspicuous region in hell so nobody sees them. If I activate the move region command down to Hell when it hasnt rendered yet (just loaded map, slow rendering), then when I go down there the blocks are gone.
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 30, 2014, 07:34:31 PM
is there any way w scripts or circuits to make like a code or theres a specific order that you have to push via burttons for something to happen...say like a door or something?
Oui, monsieur.. Saving script blocks as components would be my main ingredienta, add a little Paste, then a pinch of logic gate to flavour.
Bon apatite!

i may post a step by step using one method i thought of sometime. pretty cool gadget to have in a world, i wanna refine the design to minimals first but am not working on that atm
can get a general idea of one way to do it in the top spoiler of this thread (http://totalminerforums.net/index.php?topic=4807.msg58749#msg58749), its not a guide, just a concept
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 30, 2014, 08:10:05 PM
So I had a question regarding the use of [aux] in script commands.

My scenario is that I want a giant block door to "swing outwards" by using the move region command. Basically door pointing east-west will rotate 90 degrees to face north-south.

Would the [aux] command be used to make the blocks face a new direction?
Or will I have to move the east-west door piece away and move in the north-south one, to make the illusion that the blocks change directions?

I tried using it, but it didn't change the direction that the door would face. Im starting to think maybe the [aux] would only change the direction that direction-sensitive blocks (one way glass, ramps, stairs) in the move region would change, not the direction of the entire region itself.
Yes, the Aux parameter is relative to individual blocks, not selected regions.
The MoveRegion command has just 3 position parameters, no aux.
It is used for the direction stairs will face, ect. as you noticed.

Using just DD comands, coz i know thats your mode, i'd say that if the 'door' contains any detail, i.e. it is Not just a plain block wall, then I think the easiest way would probably be to make 2 doors, yes, and have them each move into their places to look like it opened.

could even add another door/frame in between being Open/Closed using the same method, so it looks even gooder. yes, gooder.
Title: Re: -=[How to]=- Make Scripts
Post by: Littleman9Mew2 on April 30, 2014, 08:37:56 PM
What the thing on the script block where you can set the radius for something.

What does this radius perameter do?
Title: Re: -=[How to]=- Make Scripts
Post by: muD on April 30, 2014, 08:48:13 PM
What the thing on the script block where you can set the radius for something.

What does this radius perameter do?
There is a script block setting for 'Look at Range'. This sets the distance a player can be from the script block to be able to make it Power On by looking at it.
16 blocks away is the max distance.

..i think this is what you were referring to..
Title: Re: -=[How to]=- Make Scripts
Post by: Littleman9Mew2 on April 30, 2014, 08:55:43 PM
There is a script block setting for 'Look at Range'. This sets the distance a player can be from the script block to be able to make it Power On by looking at it.
16 blocks away is the max distance.

..i think this is what you were referring to..
Yes this is what i was referring to thanks!
Title: Re: -=[How to]=- Make Scripts
Post by: Craig on May 01, 2014, 07:31:19 AM
Aux Data - Auxiliary data

Every block in the map has 8 bits of data available to it called auxiliary data.

Bits 1 - 3 are used for orientation and state.

Bit 4 is used to store whether or not the block is the originally generated block or whether it has been changed since generation (by a player or something else). This bit cannot be manipulated by script commands.

Bits 5 - 8 are used to store the selected texture id's (value range = 0-15 = 16 possible textures).

In order to calculate the Aux values by hand, you must understand the binary number system and how to form separate values in different groups of bits and combine them to calculate the final number.

http://en.wikipedia.org/wiki/Binary_number
http://en.wikipedia.org/wiki/Bitwise_operation
http://en.wikipedia.org/wiki/Bit_manipulation
http://en.wikipedia.org/wiki/Bit_field
http://en.wikipedia.org/wiki/Mask_%28computing%29

-----------------------------------------------------------------------------------------

Any block that has orientation: doors, trapdoors, stairs, ramps, one way glass, paintings, climbing ivy, torches, ladders, switches, buttons, beds, cylinders, use Bits 1 - 3 to define their orientation.


The following blocks can only face NSEW. They use Bits 1 and 2 to define the direction they face. A value from 0 to 3 inclusive. 0 = Facing East, 1 = Facing South, 2 = Facing West, 3 = Facing North.

Doors
Trapdoors
Stairs
Ramps
OneWayGlass
Beds
Cylinders

Cylinders are slightly different in that if Bit 3 = 0, then they are upright and Bits 1 - 2 are ignored. If Bit 3 = 1, then they are horizontal and Bits 1 - 2 are used to define their orientation.

Doors and Trapdoors use Bit 3 to define their state. 0 = Closed, 1 = Open.


The following blocks can be attached to the face of another block. They use Bits 1 - 3 to define the face they are attached to. A value from 0 to 5 inclusive. 0 = East face, 1 = South face, 2 = West face, 3 = North face, 4 = Top face, 5 = Bottom face.

ClimbingIvy
Switches
Buttons
Ladders
Torches
Paintings

Ladders and ClimbingIvy cannot be attached to the top or bottom face, so they cannot have a value higher than 3.

Torches cannot be attached to the bottom face, so they cannot have a value higher than 4.

Paintings are slightly different. They use Bits 1 - 2 to define the NSEW face they are attached to, but if Bit 3 = 1, then they are attached to the top face of the other block, facing up, and Bits 1 - 2 are now used to define their orientation.

Half Block:
Only uses Bit 1. If Bit 1 = 0, they are grounded, if Bit 1 = 1, they are raised.

Shops.
If Bit 1 = 1 they are economized.

Crops:
Bits 1 - 3 are used to define their current growth stage. Values 0 - 5 (6 stages).
Bits 5 - 8 are used to define the crop. Current values 0 - 2 (Wheat, Sugar Cane, Tomato).

Keys:
Bits 1 - 3 and 5 - 8 are used to define the key id.
0 = Skeleton key, 1 = Skull key. It's tricky to work this out by hand because Bit 4 is not used.

---------------------------------------------------------------------------

Textures

All blocks that can have their textures changed, including Paintings, use bits 5 - 8 of their Aux data to define the slot id for their texture.

0 = Default
1 - 15 = The slot id. That is the slot on the texture selection screen, not the block id itself.

e.g. If for Stairs you had Default, ConcreteBrick, WoodPlank, LimeStone and Glass selected as your textures, then a value of 3 will cause the stairs to be drawn with the LimeStone texture.
Title: Re: -=[How to]=- Make Scripts
Post by: muD on May 01, 2014, 07:45:46 AM
Thanks for the detailed info, Craig. Very useful. Added in OP.
Title: Re: -=[How to]=- Make Scripts
Post by: Craig on May 01, 2014, 08:08:55 AM
You'll need to replace the following text as I made some late changes to do with ladders.



The following blocks can only face NSEW. They use Bits 1 and 2 to define the direction they face. A value from 0 to 3 inclusive. 0 = Facing East, 1 = Facing South, 2 = Facing West, 3 = Facing North.

Doors
Trapdoors
Stairs
Ramps
OneWayGlass
Beds
Cylinders

Cylinders are slightly different in that if Bit 3 = 0, then they are upright and Bits 1 - 2 are ignored. If Bit 3 = 1, then they are horizontal and Bits 1 - 2 are used to define their orientation.

Doors and Trapdoors use Bit 3 to define their state. 0 = Closed, 1 = Open.


The following blocks can be attached to the face of another block. They use Bits 1 - 3 to define the face they are attached to. A value from 0 to 5 inclusive. 0 = East face, 1 = South face, 2 = West face, 3 = North face, 4 = Top face, 5 = Bottom face.

ClimbingIvy
Switches
Buttons
Ladders
Torches
Paintings

Ladders and ClimbingIvy cannot be attached to the top or bottom face, so they cannot have a value higher than 3.

Title: Re: -=[How to]=- Make Scripts
Post by: Keaton Potatoes on May 01, 2014, 08:29:41 AM
Bit 4 is used to store whether or not the block is the originally generated block or whether it has been changed since generation (by a player or something else). This bit cannot be manipulated by script commands.
So if someone were to use a script to dig a hole (Without breaking a thing, just clear region I think it is x,y,z, by x,y,z,) and when they quit and loaded the map again it wouldn't be a hole in the ground anymore?
Title: Re: -=[How to]=- Make Scripts
Post by: Nefty on May 01, 2014, 09:47:12 AM
Question, can I trap someone inside of a block.

Not like:

Block Block Block
Block Me     Block
Block Me     Block
Block Block Block

But like:

BloPersonck
BloPersonck
Title: Re: -=[How to]=- Make Scripts
Post by: muD on May 01, 2014, 10:24:40 AM
Question, can I trap someone inside of a block.

Not like:

Block Block Block
Block Me     Block
Block Me     Block
Block Block Block

But like:

BloPersonck
BloPersonck
You can, but it depends which technique you use..
Trying to Move/Fill a region or Add blocks to where the player is, usually ends up with the blocks simply not spawning there, but if the player is moving then it can by chance spawn the blocks at the right time and trap them inside. Most of often not tho.

Teleporting them would be the most effective way of ensuring they get trapped literally inside blocks in a precise location.
Title: Re: -=[How to]=- Make Scripts
Post by: Dauntless395 on May 01, 2014, 10:31:27 AM
You can, but it depends which technique you use..
Trying to Move/Fill a region or Add blocks to where the player is

I have used the "move region" on top of myself plenty of times. It works :P
Title: Re: -=[How to]=- Make Scripts
Post by: BigPapa on May 12, 2014, 09:02:43 PM
Need help with a script. I was trying the hidden door pretty simple i thouhgt. So I made a cleared out my change log added the two blocks for the "close script" maded/saved the script. Cleared out the change log again removed the two blocks made anothe script from new change log for open and saved it as "open". I tried running it manually and for the life of me I cant get the close to work. The open works fine.

The close looks like this:

AddBlock [x,y,z] [blocktype] [] "note "0" is between [] it just posted weird if 0 was inside the []
AddBlock [x,y,z] [blocktype] []

Also I was wonder if you could use a button on the script block to power the door? Maybe something like

ClearBlock
Notify [Open]
Wait [5000]
AddBlock
Notify [Close]

Of course the clear block and add blocks would have all the other info.
Title: Re: -=[How to]=- Make Scripts
Post by: muD on May 14, 2014, 05:36:30 PM
Need help with a script. I was trying the hidden door pretty simple i thouhgt. So I made a cleared out my change log added the two blocks for the "close script" maded/saved the script. Cleared out the change log again removed the two blocks made anothe script from new change log for open and saved it as "open". I tried running it manually and for the life of me I cant get the close to work. The open works fine.

The close looks like this:

AddBlock [x,y,z] [blocktype] [] "note "0" is between [] it just posted weird if 0 was inside the []
AddBlock [x,y,z] [blocktype] []

Also I was wonder if you could use a button on the script block to power the door? Maybe something like

ClearBlock
Notify [Open]
Wait [5000]
AddBlock
Notify [Close]

Of course the clear block and add blocks would have all the other info.
If you post both the open & close scripts complete with coordinates the problem should reveal itself.

Yes a button on a script block will work fine with the script you posted.
That'll open the doorway for 5 seconds before closing
Title: Re: -=[How to]=- Make Scripts
Post by: muD on May 22, 2014, 10:04:09 AM
*added Tutorial 4: Paste a component by script
*updated some command line info
Title: Re: [How to] Make Scripts
Post by: muD on June 08, 2014, 07:05:53 PM
* Rewrote Command Lines section
* Added Zone command line info.
Title: Re: [How to] Make Scripts
Post by: Jack Of Shades on June 12, 2014, 07:22:06 PM
I love this guide, very informative, tells you all the basics in an easy to understand way. My favorite Script I learned on my own, and still use, is FillRegion. I typically use it for my creative skill map, let's players mine a large area of a particular ore until gone. Then they simply push a button and it fills up full! Very awesome! +1
Title: Re: [How to] Make Scripts
Post by: muD on June 28, 2014, 05:55:13 AM
* Added Fog command line info.
* Added Marker command line info.
* Added Rain command line info.
* Added Waypoint command line info.

available in v2.04
Title: Re: [How to] Make Scripts
Post by: Craig on June 29, 2014, 06:39:02 PM
A couple of changes:

Fog [x,z] [radius] [duration] [intensity] [r,g,b] [visibility]
Rain [x,z] [radius] [duration] [intensity] [r,g,b]

Note: as with most script commands, because the parameters are not named, parameter omission must start from the last parameter, so for example, if you want to omit color [r,g,b] from the Fog command, you must also omit [visibility].

The section quoted below can now be removed from Extra Info, as it is no longer an issue.
"It is a bad idea to cause a script to wait for more than a couple of seconds. The reason for this is because when a script is executing it uses a background thread. The game only has 3 background threads available to it, so while a script is executing, there are only 2 left. Background threads do many many things in TM, including lighting, loading chunk graphics, and streaming data in multiplayer. So if you're holding up 1 of the 3 background threads by having a script needlessly wait for long periods, other things will take longer to get done. It won't cause lag as in low frame rates, but could cause lag in terms of things taking longer to finish than they might otherwise."

A 3rd weather effect has been added, which is also controllable by a script command, but this will remain a surprise for the next update.
Title: Re: [How to] Make Scripts
Post by: Zoidberg on June 29, 2014, 06:45:00 PM
.
Title: Re: [How to] Make Scripts
Post by: Dryym on June 30, 2014, 08:03:26 AM
Would you be able to run

Fog [512,512] [511] [999999] [15] [44,0,0] [100]

To make a tinted sky effect on the whole map for a very long time?
Title: Re: [How to] Make Scripts
Post by: Craig on June 30, 2014, 08:54:42 AM
Yes, duration is not restricted.
Title: Re: [How to] Make Scripts
Post by: Dryym on June 30, 2014, 09:06:02 AM
Also, Is there any way to cancel weather effects, Or do you just have to wait until the time runs out?
Title: Re: [How to] Make Scripts
Post by: Craig on June 30, 2014, 09:10:24 AM
There is currently no way to cancel weather effects.
Title: Re: [How to] Make Scripts
Post by: Titan on October 23, 2015, 10:56:26 PM
Anyone know how to do the facing direction so when a player buys a bank the sign will be on the wall?
Title: Re: [How to] Make Scripts
Post by: Dark Hydrak on November 06, 2015, 12:40:38 AM
Craig said that he -may- change the script layout.