Create a free account to remove all ad content.

Author Topic:  [How to] Make Scripts  (Read 27614 times)

0 Members and 1 Guest are viewing this topic.

muD

  • Legendary Member
  • *
  • Posts: 1177
    • View Profile
Re: -=[How to]=- Make Scripts
« Reply #100 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

muD

  • Legendary Member
  • *
  • Posts: 1177
    • View Profile
Re: -=[How to]=- Make Scripts
« Reply #101 on: May 22, 2014, 10:04:09 AM »
*added Tutorial 4: Paste a component by script
*updated some command line info

muD

  • Legendary Member
  • *
  • Posts: 1177
    • View Profile
Re: [How to] Make Scripts
« Reply #102 on: June 08, 2014, 07:05:53 PM »
* Rewrote Command Lines section
* Added Zone command line info.

Jack Of Shades

  • Guest
Re: [How to] Make Scripts
« Reply #103 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

muD

  • Legendary Member
  • *
  • Posts: 1177
    • View Profile
Re: [How to] Make Scripts
« Reply #104 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

Craig

  • Developer
  • Extreme Member
  • *
  • Posts: 6655
  • Dig Deep
    • View Profile
    • Twitter
  • Steam: tota1miner
Re: [How to] Make Scripts
« Reply #105 on: June 29, 2014, 06:39:02 PM »
A couple of changes:

Fog [x,z] [radius] [duration] [intensity] [r,g,b] [visibility]
  • [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.
Rain [x,z] [radius] [duration] [intensity] [r,g,b]
  • [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.
  • Color [r,g,b] is an optional parameter (it can be omitted). If it is omitted, the value used is [153,153,178+/-r]  where r is a random number between 0 - 51.

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.

Zoidberg

  • Legendary Member
  • *
  • Posts: 1445
    • View Profile
  • Xbox: v Zoidberg v
  • Steam: v_Zoidberg_v
Re: [How to] Make Scripts
« Reply #106 on: June 29, 2014, 06:45:00 PM »
.
« Last Edit: December 22, 2014, 05:11:08 PM by Zoidberg »


Dryym

  • Supreme Member
  • *
  • Posts: 4336
  • What's yours is mine. ~TM's Resident Master Thief~
    • View Profile
  • Xbox: dryym
Re: [How to] Make Scripts
« Reply #107 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?

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

Craig

  • Developer
  • Extreme Member
  • *
  • Posts: 6655
  • Dig Deep
    • View Profile
    • Twitter
  • Steam: tota1miner
Re: [How to] Make Scripts
« Reply #108 on: June 30, 2014, 08:54:42 AM »
Yes, duration is not restricted.

Dryym

  • Supreme Member
  • *
  • Posts: 4336
  • What's yours is mine. ~TM's Resident Master Thief~
    • View Profile
  • Xbox: dryym
Re: [How to] Make Scripts
« Reply #109 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?

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym