<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.hackslashmine.net/hsmwiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.hackslashmine.net/hsmwiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=78.215.52.208</id>
		<title>Hack/Mine Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.hackslashmine.net/hsmwiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=78.215.52.208"/>
		<link rel="alternate" type="text/html" href="http://www.hackslashmine.net/hsmwiki/Special:Contributions/78.215.52.208"/>
		<updated>2026-07-04T07:41:37Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.19.2</generator>

	<entry>
		<id>http://www.hackslashmine.net/hsmwiki/Spellscript_Tutorial</id>
		<title>Spellscript Tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.hackslashmine.net/hsmwiki/Spellscript_Tutorial"/>
				<updated>2014-08-25T17:53:06Z</updated>
		
		<summary type="html">&lt;p&gt;78.215.52.208: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mbox|type=caution|text=This article is totally a work-in-progress, y'all.}}&lt;br /&gt;
This is an informal guide on how to get started creating Spellscript scripts in Minecraft.  This guide will assume you're an absolute beginner to programming, and will do its best to not only explain the syntax of Spellscript, but give you a solid introduction to the concepts behind programming as well (you'll need them to make awesome scripts!)&lt;br /&gt;
&lt;br /&gt;
See [[Spellscript]] for a general language reference-- otherwise, read on...&lt;br /&gt;
&lt;br /&gt;
==Working with Blocks, Calling ''Methods''==&lt;br /&gt;
Alright young padawan, you've mastered the way of the ''print'' statement... it is time to start working with blocks.&lt;br /&gt;
&lt;br /&gt;
As you may already know, blocks are simply the combination of a ''blockID'' and a ''metadata'' at a given position, integers x, y, and z.  You can actually view your character's position in terms of blocks by pressing ''F3'' outside of any menu.  (See where it says 'x', 'y', and 'z'?)  Go ahead and pick an empty position you'd like to stick a ''tower'' of blocks by using ''F3'', remembering to floor them to integers (e.g. '17.256' becomes '17' and '-45.3' becomes '-46').  Then, type the following into your script-block, replacing 'x', 'y', and 'z' with your chosen coordinates:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;for int i in 10:&lt;br /&gt;
    world.setBlockID(x, y + i, z, 20)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Give the lever a tug, and WALLAH!  An instant tower o' glass, baby.  Let's explain...&lt;br /&gt;
&lt;br /&gt;
You'll notice a variable 'world' of type ''World'' that we never declared-- this variable was handed to us by the Spellscript block and contains the world that the Spellscript-Block exists in (the Surface, the Nether, the End, etc).  You can find all such variables and their types by bringing up the ''Info Screen'' via ''ctrl''+''/''.&lt;br /&gt;
&lt;br /&gt;
In this script, we simply iterate over the integers [''0''..''9''], and with each iteration call a ''method'' belonging to 'world' entitled 'setBlockID', that does exactly what its name implies: it sets a block at a given position in the world to a given block ID.  The position and block are specified by passing the method a few ''parameters'' when it's called: ''x'', ''y'', ''z'', and ''blockID''.&lt;br /&gt;
&lt;br /&gt;
A method is essentially a predefined snippet of code belonging to a type.  Using the ''dot'' (&amp;quot;.&amp;quot;) operator, they can be passed a particular set of ''parameters'' and then executed (or &amp;quot;called&amp;quot;, as we say in the business).  In our case, ''setBlockID'' is a method belonging to ''World'' that accepts four ''int'' parameters: the x, y, and z coordinates we want to place the block at, and the blockID we want to place.&lt;br /&gt;
&lt;br /&gt;
Simple enough, right?  Make sure you understand everything in this section before moving on, since it's fixing to get more complicated (and therefore FUN!!!)&lt;br /&gt;
&lt;br /&gt;
==Polymorphism==&lt;br /&gt;
To truly understand methods and types, you must first understand the programming concept of Polymorphism, which basically means an object can be of more than one type at once.  In Spellscript (as in many programming languages), this is accomplished via &amp;quot;inheritance.&amp;quot;  You can think of it as a square-rectangle relationship...&lt;br /&gt;
&lt;br /&gt;
Suppose there are two types, ''Player'' and ''Living'', and ''Player'' &amp;quot;inherits&amp;quot; from ''Living''.  Just as a square is a rectangle, a ''Player'' is a ''Living''-- however, the converse isn't necessarily true.  That is, just as a rectangle isn't necessarily a square, a ''Living'' isn't necessarily a ''Player''.  &amp;lt;!-- The ''isa'' and ''as'' operations allow us to check for the corner cases when a rectangle ''happens'' to be a square, or a ''Living'' happens to be ''Player''. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nature of this relationship let's Spellscript do useful things, particularly with methods.  If a type B inherits from type A, then objects of type B have all the methods of type A, in addition to their own.  Even better, if a type C inherits from type B, then C has all the methods of type B ''and'' A!  Thus in our case, if ''Player'' inherits from ''Living'', and ''Living'' inherits from ''Entity'', it follows that ''Player'' has all the methods of ''Living'' and ''Entity'' in addition to its own!&lt;br /&gt;
&lt;br /&gt;
This is vital information, as it enables you to understand what methods are available on which objects in Spellscript.  To see all of Hack/Mine's available methods in the [[Spellscript IDE]], simply press ''ctrl''+''m''.  You can also find an [[Hack/Mine Methods and Globals|updated list of methods]] here on the wiki.  You'll see a list of all the types available, in addition to what types they inherit from and what methods belong to them.  So if ''Entity'' has a method ''getX'', so do ''Living'' and ''Player''.  Piece of cake!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;to be continued...&amp;gt;&lt;/div&gt;</summary>
		<author><name>78.215.52.208</name></author>	</entry>

	</feed>