<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Wiremod.com Forums - Expression Tutorials</title>
		<link>http://www.wiremod.com/forum/</link>
		<description>Tutorials for Expression 1/2</description>
		<language>en</language>
		<lastBuildDate>Thu, 09 Sep 2010 11:57:13 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.wiremod.com/forum/images/vblue/misc/rss.png</url>
			<title>Wiremod.com Forums - Expression Tutorials</title>
			<link>http://www.wiremod.com/forum/</link>
		</image>
		<item>
			<title><![CDATA[Whosdr's In-Game tutorials]]></title>
			<link>http://www.wiremod.com/forum/expression-tutorials/22107-whosdrs-game-tutorials.html</link>
			<pubDate>Thu, 19 Aug 2010 19:45:04 GMT</pubDate>
			<description><![CDATA[I've come to the conclusion that some tutorials are outdated, or don't cover some details which many require. A lot of people also don't play in...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I've come to the conclusion that some tutorials are outdated, or don't cover some details which many require. A lot of people also don't play in windowed mode, and find it annoying to flicker back and forwards, so I've taken it upon myself to write some in-game tutorials.<br />
<br />
Tutorials so far:<br />
Console screen<br />
Holograms<br />
Optimization<br />
Chat<br />
Variables<br />
<br />
More coming soon (hopefully)<br />
<br />
<br />
--Console Screen---<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">@name Whosdr's in-game tutorial series - Console Screens<br />
#<br />
#################<br />
#Console Screens#<br />
#################<br />
#<br />
#<br />
#<br />
#<br />
#<br />
#########Console Screens#########<br />
#Console screens are screens capable of writing text to.<br />
#The resolution of the screen is 30x18.<br />
#That's cells 0-29 across, and 0-17 down.<br />
#The screen is found under Wire - Display<br />
#<br />
#To wire a console screen, you have you use a 'wirelink'.<br />
#It's defined as:<br />
#@inputs Screen:wirelink<br />
#<br />
#Wirelinks can be linked with the Advanced Wire tool.<br />
#If you use the normal wire tool, you need to use the <br />
#Expression2 Wirelink tool on the console screen first.<br />
#<br />
#To draw text to a console screen you use the following<br />
#Screen:writeString(Text,X Pos,Y Pos,Color*,Background Color*,Flashing*)<br />
#<br />
#Color and background colors use a rgb (red-green-blue) value.<br />
#For instance, 900 is red (9 red, 0 green, 0 blue)<br />
#Whilst 990 is yellow (9 red, 9 green, 0 blue)<br />
#<br />
#Flashing is when the background and foreground swap every second.<br />
#Possible values are 1 and 0.<br />
#<br />
#For example:<br />
#Screen:writeString(&quot;Hello World!&quot;,0,9,999,0,0)<br />
#Would make white text(999) on a black background (0)<br />
#not flashing (0) at the top (0) centre (9)<br />
#<br />
#List of colours:<br />
#<br />
#Red&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 900<br />
#Green&nbsp; &nbsp; &nbsp; &nbsp;  90<br />
#Blue&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  9<br />
#Light blue&nbsp; &nbsp; 49<br />
#White&nbsp; &nbsp; &nbsp; &nbsp; 999<br />
#Black&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br />
#Purple&nbsp; &nbsp; &nbsp;  909<br />
#Pink&nbsp; &nbsp; &nbsp; &nbsp;  944<br />
#Orange&nbsp; &nbsp; &nbsp;  940<br />
#cyan&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 99<br />
#<br />
#Other useful info:<br />
#Screen[2041] = 1 removes everything written to the screen<br />
#Screen[2042] = Background Color* to change the whole screens<br />
#background color<br />
#Screen[2024] = 0-3 to change rotation. It rotates the screen,<br />
#but text stays upright. Set to 1 to make the res 18x30.<br />
#DON'T rewrite non-changing text. Use a first or learn 'optimization'<br />
#<br />
#<br />
#<br />
#<br />
####Advanced####<br />
#<br />
#If and when making a console based OS (We all do it)<br />
#These are some things I use personally.<br />
#<br />
#-[The 'Page' variable.]-#<br />
#I use this variable for changing pages. It's a string var<br />
#@persist Page:string<br />
#and I set it to the name of the page, then use an if statement.<br />
#if (Page == &quot;name_of_page&quot;) {}<br />
#In the {} you've got all the code for that page.<br />
#<br />
#-[Keyboard]-#<br />
#A wired keyboard is 'very' useful for user input.<br />
#If you make a variable (In this case, String:string)<br />
#then you can add text onto it.<br />
#<br />
#@name Keyboard_example<br />
#@inputs Screen:wirelink Key<br />
#@persist String:string<br />
#if (Key &amp; ~Key) { #~Key means the button was pressed.<br />
#&nbsp; &nbsp; if (Key == 127) { #If the key is backspace<br />
#&nbsp; &nbsp; &nbsp; &nbsp; String = String:sub(1,String:count()-1)<br />
#&nbsp; &nbsp; &nbsp; &nbsp; #Removes the last character from string<br />
#&nbsp; &nbsp; } elseif (Key == 154) { #So shift doesn't leave a space<br />
#&nbsp; &nbsp; } elseif (Key == 13) { #Enter key<br />
#&nbsp; &nbsp; &nbsp;  if (String == &quot;&quot;) { #Check string, execute code here<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
#&nbsp; &nbsp; &nbsp;  }<br />
#&nbsp; &nbsp; } else {<br />
#&nbsp; &nbsp; &nbsp;  String += toChar(Key) #Key is a byte value (number). toChar<br />
#&nbsp; &nbsp; }&nbsp; #Turns it into a string value. Aka, A = 97, B = 97, a = 65<br />
#}<br />
#<br />
#<br />
#<br />
#One thing people ask for is percentage or progress bars.<br />
#This can be achived by using spaces and a background colour.<br />
#Screen:writeString(&quot; &quot;:repeat(How_many_bars),XPos,YPos,0,Color)<br />
#To convert a percentage, use round(Value/Max*Size) where<br />
#Size is how many boxes it will take when full<br />
#<br />
#<br />
#One more of my tricks is a 'Refresh' variable. @persist Refresh<br />
#When changing a page, I set this variable to 1.<br />
#I check the variable in the new page, and set it to 0.<br />
#At the same time, I put in any text which doesn't change.<br />
#This saves on ops and server lag.</code><hr />
</div> <br />
---Holograms---<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">@name Whosdr's in-game tutorial series - Holograms<br />
#<br />
###########<br />
#Holograms#<br />
###########<br />
#<br />
#Holograms are rescalable entities with no collisions.<br />
#You can't touch them, they have no gravity, you can't toolgun them.<br />
#However, they work very nicely for display, as they're easy<br />
#to move, and cause almost no lag. They're currently only able to<br />
#be created by Expression 2, as an entity would take too many wires.<br />
#<br />
#To create a hologram, you use holoCreate(N). N is the index, used<br />
#to edit it with. You can normally create up to 50 holograms,<br />
#but only 30 per second. If you're using this hologram permanently<br />
#then it is suggested to put this under first(), along with editing<br />
#other properties which don't require changing, such as color and<br />
#material.<br />
#<br />
#holoModel(Index,Path) allows you to change the hologram model<br />
#into any of wires specific models. These are:<br />
#<br />
#####################Model List##########################<br />
#cube&nbsp; &nbsp; &nbsp;  Default model&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#plane&nbsp; &nbsp; &nbsp; A square only visible from one side&nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#prism&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#pyramid&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#tetra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#dome&nbsp; &nbsp; &nbsp;  Filled dome (|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#dome2&nbsp; &nbsp; &nbsp; Hollow dome ((&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#cone&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#hqcone&nbsp; &nbsp;  hq are high quality. They're less blocky&nbsp; &nbsp; #<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#cylinder&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#hqcylinder&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#hqcylinder2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#icosphere&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#icosphere2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#icosphere3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#hqicosphere&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#hqicosphere2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#sphere&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#sphere2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#sphere3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#hqsphere&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#hqsphere2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#torus&nbsp; &nbsp; &nbsp; Torus is a doughnut really.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#torus2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#torus3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#hqtorus&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #<br />
#hqtorus2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
#########################################################<br />
#<br />
#However, now with the Wire Unofficial Extras SVN,<br />
#you can run a console command on the server to allow you to<br />
#use any model on the server. Anything from explosive barrels to <br />
#SBEP entities. The command is wire_holograms_modelany 1.<br />
#Once enabled, simply put the full path of the model in<br />
#(Can be found by right clicking it in the spawn menu and <br />
#clicking copy to clipboard, then paste into E2 editor.)<br />
#<br />
#<br />
#The next thing you'll want to do after creating and modeling<br />
#is positioning. The command is holoPos(Index,Position)<br />
#Position is a vector, which can be created using vec(X,Y,Z)<br />
#<br />
#Sometimes you'll want to make the hologram stick to the expression.<br />
#People make the mistake of using holoPos(1,entity():pos()+vec(X,Y,Z))<br />
#However, if you rotate it, it'll come out wrong.<br />
#The correct way to do this is holoPos(1,entity():toWorld(vec(X,Y,Z))<br />
#This takes angles into account to ensure It'll always spawn correctly.<br />
#<br />
#The next one can be quite tricky. holoAng(Index,Angle)<br />
#This sets the angle of the holograms. Angles can be tricky, I'd suggest<br />
#reading a tutorial about them, or you may get frustrated.<br />
#<br />
#Ok, now it's nice to have the hologram you want, but it's quite boring.<br />
#The default ones are plain white, which does not look very cool.<br />
#Lets add some detail, with holoMaterial and holoColor.<br />
#<br />
#As the names suggest, these set the color and materials of a hologram.<br />
#holoColor(Index,Red,Green,Blue,Alpha)<br />
#holoColor(Index,vec(Red,Green,Blue),Alpha)<br />
#holoColor(Index,Red,Green,Blue)<br />
#holoColor(Index,vec(Red,Green,Blue)<br />
#They all do the same thing. Set the colour of the hologram.<br />
#Red,Green and blue can each hold a value of 0-255.<br />
#<br />
#Colours are combined like so.<br />
#<br />
#Red&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 255&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp;  0<br />
#Green&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; 255&nbsp; &nbsp; &nbsp;  0<br />
#Blue&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp;  255<br />
#Light Blue&nbsp; &nbsp; &nbsp;  0&nbsp; &nbsp; 150&nbsp; &nbsp;  255<br />
#Purple&nbsp; &nbsp; &nbsp; &nbsp;  255&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp;  255<br />
#Pink&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  255&nbsp; &nbsp; 100&nbsp; &nbsp;  100<br />
#Orange&nbsp; &nbsp; &nbsp; &nbsp;  255&nbsp; &nbsp; 150&nbsp; &nbsp; &nbsp;  0<br />
#Yellow&nbsp; &nbsp; &nbsp; &nbsp;  255&nbsp; &nbsp; 255&nbsp; &nbsp; &nbsp;  0<br />
#<br />
#For instance, a green hologram would be holoColor(Index,0,255,0)<br />
#(That's no red, full green and no blue)<br />
#If you add an equal value to the other values, it becomes lighter.<br />
#<br />
#The last one is alpha. This is the opacity. The oposite of transparancy.<br />
#In this case, 255 would be as solid as a brick, whilst 0 would be invisible.<br />
#<br />
#You can set the alpha to 0 to make it look like the hologram is gone.<br />
#It uses less ops than having to delete (holoDelete(Index)) and recreate <br />
#the hologram.<br />
#<br />
#holoMaterial sets the material, much like the material tool.<br />
#holoMaterial(Index,Path)<br />
#Path is a string, the same with model. They need to be wrapped in &quot;'s.<br />
#holoMaterial(Index,&quot;models/jeep/jeep&quot;) is the material of the jeep.<br />
#<br />
#An important part I seem to have forgot is that holograms are resizable.<br />
#<br />
#The command holoScale(Index,Size) is used to rescale them.<br />
#The default size of any model is vec(1,1,1), so vec(2,2,2) is exactly double.<br />
#The maximum size of any object is 20 units in any direction (correct me if I'm wrong)<br />
#<br />
#Now, if you want to keep a hologram sort of 'welded' to an object, or even<br />
#another hologram, you use holoParent(Index,Index) or holoParent(Index,Entity)<br />
#Whilst parented, you can still edit the position and angle, but it'll always<br />
#rotate and move to the entity you parented it to.<br />
#You can unparent it simply by using holoUnparent(Index)<br />
#<br />
#A few more things.<br />
#holoEntity(Index) returns the holograms entity.<br />
#A negative scale causes you to see the back over the front.<br />
#A negative index allows all your E2s to edit the hologram.<br />
#It becomes global to you.<br />
#<br />
#holoCreate(1)<br />
#holoModel(1,&quot;hqsphere2&quot;)<br />
#holoPos(1,entity():toWorld(vec(0,0,100)))<br />
#holoAng(1,entity():angles())<br />
#holoColor(1,vec(100,255,100))<br />
#holoMaterial(1,&quot;models/flesh&quot;)<br />
#holoParent(1,entity())<br />
#holoScale(1,vec(5,5,2))<br />
#<br />
#<br />
##########<br />
#Advanced#<br />
##########<br />
#<br />
#Animations. Simple animations are easy with a seperate position vector or number to each.<br />
#People ask me how I create open and closing movements. Well, bellow is how.<br />
#<br />
#@name Movement Example<br />
#@inputs Open<br />
#@persist Pos E:entity<br />
#if (first()) {<br />
#&nbsp; &nbsp; E = entity() #Set E to entity()<br />
#&nbsp; &nbsp; Pos = 20&nbsp; &nbsp;  #Starting units<br />
#<br />
#&nbsp; &nbsp; holoCreate(1)<br />
#&nbsp; &nbsp; holoModel(1,&quot;cube&quot;) #Cube. Not required here, but is here for example.<br />
#&nbsp; &nbsp; holoScale(1,vec(0.1,4,8)) #0.1 unit deep, 4 wide and 8 tall<br />
#&nbsp; &nbsp; holoMaterial(1,&quot;models/props_combine/combine_fenceglow&quot;) #Combine fence<br />
#&nbsp; &nbsp; holoAng(1,E:toWorld(ang(0,180,0))) #180 rotated 180 in yaw.<br />
#&nbsp;  <br />
#&nbsp; &nbsp; holoCreate(2)<br />
#&nbsp; &nbsp; holoModel(2,&quot;cube&quot;)<br />
#&nbsp; &nbsp; holoScale(2,vec(0.1,4,8))<br />
#&nbsp; &nbsp; holoMaterial(2,&quot;models/props_combine/combine_fenceglow&quot;)<br />
#&nbsp; &nbsp; holoAng(2,E:toWorld(ang(0,0,0)))<br />
#<br />
#}<br />
#<br />
#interval(50)<br />
#if (Open) { #If opened<br />
#&nbsp; &nbsp; if (Pos &lt; 50) {Pos++} #If position is less than 50 then increase<br />
#} else { #If closed<br />
#&nbsp; &nbsp; if (Pos &gt; 20) {Pos--} #If position is more than 0 then decrease<br />
#}<br />
#<br />
#holoPos(1,E:toWorld(vec(0, Pos,0))) #Position Pos units to the right<br />
#holoPos(2,E:toWorld(vec(0,-Pos,0))) #Position Pos units to the left<br />
#<br />
#<br />
#To have a hologram rotate around a point, use holoPos(Index,vec(Distance,0,0):rotate(ang(0,curtime()*Speed,0))) on an interval.<br />
#To have it rotate in angles, you can use curtime()*Speed in any angle part of holoAng. Yaw would be<br />
#holoAng(Index,ang(Pitch,curtime()*Speed,Roll))<br />
#Or you could use holoAng(Index,holoEntity(Index):toWorld(ang(PitchSpeed,YawSpeed,RollSpeed)))</code><hr />
</div> ---Optimization---<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">@name Whosdr's in-game tutorial series - Optimization<br />
#<br />
##############<br />
#Optimization#<br />
##############<br />
#<br />
#<br />
#<br />
#<br />
#<br />
#########Optimization#########<br />
#Optimization is the process of going through your code and <br />
#minimizing ops and lag. It means only running things when they<br />
#need to be run. People make this mistake with holograms.<br />
#Luckily, Expression 2 has functions to help with this.<br />
#<br />
#<br />
#~VAR&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  This can tell us if you've just activated an input.<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  It is useful if you need to run something just once<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  when an inputs changed, even when you've got an<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  interval. E.G.<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  @inputs Active<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  runOnTick(1)&nbsp; &nbsp; #Second trigger<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (~Active) { #Active is an input<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  entity():setAlpha(Active*255)<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Only triggers when Active changes, even with<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  runOnTick(1) or interval(100)<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
#<br />
#<br />
#<br />
#$VAR&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Probably not the best, but useful in specific<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  situations. This is the delta of a variable, the change.<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  The value must be an input, output or persist.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
#<br />
#changed(VAR)&nbsp;  This triggers if the variable inbetween () changes.<br />
#-&gt;Input&nbsp; &nbsp; &nbsp; &nbsp; This is true when the input after -&gt; is wired.<br />
#<br />
#<br />
#first()&nbsp; &nbsp; &nbsp; &nbsp; This is true when the expression is first spawned.<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Things such as variable assigning (E = entity(), O = owner())<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  should be done here, and persisted.<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Creating holograms and setting their display should also be here.<br />
#<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (first()) {E = entity(),O = owner()}<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
#<br />
#duped()&nbsp; &nbsp; &nbsp; &nbsp; Similar to first(), but when pasted from duplication.<br />
#dupefinished() This returns true when every entity has finished pasting. If you use<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  isWeldedTo() or getConstraints(), it's recommended you put it here.<br />
#<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Remember, if it doesn't change, put it under first() | duped()/dupefinished().<br />
#</code><hr />
</div> <br />
---Chat---<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">@name Whosdr's in-game tutorial series - Chat<br />
#<br />
######<br />
#chat#<br />
######<br />
#<br />
#Obviously, when I say chat, I'm talking of the chat box.<br />
#Expression 2 has commands which can read what people have written<br />
#in chat. This doesn't extend to printed text.<br />
#<br />
#lastSaid()&nbsp; &nbsp; &nbsp; &nbsp; The last text said.<br />
#E:lastSaid()&nbsp; &nbsp; &nbsp; The last text said by 'E'<br />
#lastSaidTeam()&nbsp; &nbsp; The last text put in the team chat.<br />
#E:lastSaidTeam()&nbsp; The last text put in the team chat by 'E'<br />
#lastSpoke()&nbsp; &nbsp; &nbsp;  The player who put in the last chat message.<br />
#<br />
#runOnChat(1)&nbsp; &nbsp; &nbsp; Triggers an 'execution' (The expression runs)<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when someone says something.<br />
#chatClk()&nbsp; &nbsp; &nbsp; &nbsp;  Returns true when someone says something.<br />
#chatClk(E)&nbsp; &nbsp; &nbsp; &nbsp; Returns true when E says something.<br />
#hideChat(1)&nbsp; &nbsp; &nbsp;  Hides your chat.<br />
#<br />
#<br />
#The best use of lastSaid() is when combined with chatClk().<br />
#if (first()) {runOnChat(1)}<br />
#if (chatClk()) { #If someone spoke<br />
#&nbsp; &nbsp; if (lastSaid() == &quot;lol&quot;) { #If they said lol<br />
#&nbsp; &nbsp; &nbsp;  print(lastSpoke():name()+&quot; said lol!&quot;) #print their name and &quot;said lol!&quot;.<br />
#&nbsp; &nbsp; }<br />
#}<br />
#<br />
#runOnChat(1) should be put under first(), as it persists.<br />
#<br />
#Sometimes you won't want someone to see what you wrote.<br />
#This is what hideChat is for.<br />
#<br />
#if (first()) {runOnChat(1)} #only set once,<br />
#if (chatClk(owner()) {<br />
#&nbsp; &nbsp; if (owner():lastSaid():index(1) == &quot;/&quot;) { #:index(1) means the first letter.<br />
#&nbsp; &nbsp; &nbsp; &nbsp; hideChat(1) #Hides your chat.<br />
#&nbsp; &nbsp; }<br />
#}<br />
#<br />
#<br />
#Another thing is arguments. Sometimes you'll want to do something like !target player_name<br />
#Text:explode(Splitter) splits the Text by the splitter, and turns it into an array.<br />
#I'm sure I'll have a tutorial on them soon.<br />
#<br />
#<br />
#if (first()) {runOnChat(1)}<br />
#if (chatClk(owner()) {<br />
#&nbsp; &nbsp; Explode = owner():lastSaid():explode(&quot; &quot;) #Split by space.<br />
#&nbsp; &nbsp; Arg1 = Explode[1,string] #This is the text before the first space.<br />
#&nbsp; &nbsp; Arg2 = Explode[2,string] #This is the text after the first split.<br />
#&nbsp; &nbsp; #You can continue this on with Arg3 = Explode[3,string] ect.<br />
#&nbsp; &nbsp; if (Arg1 == &quot;-find&quot;) {<br />
#&nbsp; &nbsp; &nbsp; &nbsp; hideChat(1) #Hides chat<br />
#&nbsp; &nbsp; &nbsp; &nbsp; Found = findPlayerByName(Arg2) #findPlayerByName is a function for finding players.<br />
#&nbsp; &nbsp; &nbsp; &nbsp; if (Found) { #If the player was found<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(Found:name()) #Print the name<br />
#&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;No player found.&quot;) If not, print this<br />
#&nbsp; &nbsp; &nbsp; &nbsp; }<br />
#&nbsp; &nbsp; }<br />
#}<br />
#</code><hr />
</div> <br />
---Data types---<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">@name Whosdr's in-game tutorial series - Variables<br />
#<br />
###########<br />
#Variables#<br />
###########<br />
#<br />
#Expression 2 has many types of variables. These are:<br />
#<br />
#Number / Normal&nbsp; &nbsp; &nbsp; &nbsp; Things like 16, or 122.078<br />
#String&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Text. Surrounded by quotation marks. E.G. &quot;Hello!&quot;<br />
#Vector&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  3 numbers 1 in one, used in 3D math. vec(x,y,z) <br />
#Vector2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 numbers in 1, used in 2d math. vec(x,y)<br />
#Vector4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Normally used for colours. vec(x,y,z,w) / vec(red,green,blue,alpha)<br />
#Angle&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Used for angles. ang(pitch,yaw,roll)<br />
#Entity&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Every object, from barrels to weapons are entities.<br />
#Bones&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [Not covered]Parts of ragdolls.<br />
#Ranger&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Ranger data*<br />
#Arrays&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Stores many variables with a number index.<br />
#Tables&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Stores many variables with a string index.<br />
#Wirelink&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [Not covered]Fast data transfer.<br />
#Matrix&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [Not covered]*<br />
#Complex&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [Not covered]*<br />
#Quaternion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [Not covered]*<br />
#<br />
#<br />
#<br />
#<br />
#-------[Entity]-------#<br />
#Just about everything you see in the world is an object. From explosive barrels<br />
#to bouncy balls and players. Each has a position, angle ,size and mass.<br />
#All the data you can get from an entity is covered here.<br />
#http://wiki.garrysmod.com/?title=E2#Entity<br />
#It's input, output or persisted with an :entity extension.<br />
#<br />
#-------[Array]--------#<br />
#Arrays allow multiple storage of multiple datatypes in one variable, and accessed by a kind of key.<br />
#The key is the 'index' of the array, and is a number.<br />
#In arrays, you can only store one peice of data in each slot. There are 1048576 slots avalible,<br />
#but they don't have to go in order. You could write to the cell 10000000000, for instance.<br />
#It's input, output or persisted with a :array extension.<br />
#<br />
#@persist Data:array<br />
#Data[1,number] = 12 #Stores the number 12 to cell 1<br />
#Data[2,string] = &quot;Hello World!&quot; #Stores the string 'Hello World!' o cell 2.<br />
#Data[3,vector] = vec(100,200,300) #Stores the vector 100 x, 200 y, 300 z to cell 3.<br />
#Data[4,entity] = owner() #Stores your entity to cell 4.<br />
#<br />
#print(Data[4,entity]:name()+&quot;: &quot;+Data[2,string] + &quot; &quot;+Data[1,number] + &quot; &quot; +Data[3,vector])<br />
#Prints NAME: Hello World! 12 [100,200,300]<br />
#Numbers and strings can be printed. Entities can't, but the :name() turns it into a string<br />
#with the value of your name. Vectors are printed with square brackets around them.<br />
#<br />
#-------[Table]--------#<br />
#Tables work the same way as arrays, except the key is a string, and you can store multiple data<br />
#types in 1 slot.<br />
#<br />
#@persist Data:table<br />
#Name = owner():name() #Name is a string with the value of your name. For me, [END] Whosdr [E2]<br />
#Data[Name,number] = 12<br />
#Data[Name,string] = &quot;Hello World!&quot;<br />
#Data[Name,vector] = vec(100,200,300)<br />
#Data[Name,entity] = owner()<br />
#print(Name + &quot;: &quot;+Data[Name,string] + &quot; &quot; + Data[Name,number] + &quot; &quot; + Data[Name,vector])<br />
#Will also print NAME: Hello World! 12 [100,200,300]<br />
#<br />
#-------[Ranger]-------#<br />
#Rangers are like an invisible line from a position, in a direction.<br />
#Imagine a line coming out of your head, and hitting anything you're looking at.<br />
#This is basically how things like aimEntity() work. The best ranger trace I find is<br />
#RD = rangerOffset(Distance,Position,Direction) where distance is the distance to scan,<br />
#Position is the position to start at, and direction is the direction to scan in.<br />
#<br />
#It has it's own type too, :ranger when persisting, inputting or outputting.<br />
#I can now use functions like RD:hit() to find out if it hit anything,<br />
#RD:distance() to find the distance from the hit, and RD:position() to return a vector position<br />
#of where it hit.<br />
#You can exclude entities from being hit with rangerFilter(Entity) or rangerFilter(Array).<br />
#<br />
#Other functions are<br />
#rangerHitEntites(1/0) #Hit entities<br />
#rangerIgnoreWorld(1/0) #Ignore world<br />
#rangerHitWater(1/0) #Hit the water<br />
#rangerPersist(1/0) #Saves the variables above<br />
#Where 1 is yes, and 0 is no. They must be set before doing the trace.</code><hr />
</div> <br />
Feel free to make one yourself, and put I'll put it up here.<br />
And maybe when I'm bored, I'll make a html version.<!-- google_ad_section_end --></div>


	<div style="padding:10px">

	

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Files</legend>
			<ul>
			<li>
	<img class="inlineimg" src="/txt.gif" alt="File Type: txt" />
	<a href="http://www.wiremod.com/forum/attachments/expression-tutorials/7970d1282306452-whosdrs-game-tutorials-console_screen.txt">console_screen.txt</a> 
(3.5 KB)
</li> <li>
	<img class="inlineimg" src="/txt.gif" alt="File Type: txt" />
	<a href="http://www.wiremod.com/forum/attachments/expression-tutorials/7983d1282397483-whosdrs-game-tutorials-optimization.txt">optimization.txt</a> 
(2.0 KB)
</li> <li>
	<img class="inlineimg" src="/txt.gif" alt="File Type: txt" />
	<a href="http://www.wiremod.com/forum/attachments/expression-tutorials/7984d1282401224-whosdrs-game-tutorials-chat.txt">chat.txt</a> 
(2.3 KB)
</li> <li>
	<img class="inlineimg" src="/txt.gif" alt="File Type: txt" />
	<a href="http://www.wiremod.com/forum/attachments/expression-tutorials/7992d1282475737-whosdrs-game-tutorials-holograms.txt">holograms.txt</a> 
(8.3 KB)
</li> <li>
	<img class="inlineimg" src="/txt.gif" alt="File Type: txt" />
	<a href="http://www.wiremod.com/forum/attachments/expression-tutorials/7994d1282481179-whosdrs-game-tutorials-variables.txt">variables.txt</a> 
(4.0 KB)
</li> 
			</ul>
		</fieldset>
	

	</div>
 ]]></content:encoded>
			<category domain="http://www.wiremod.com/forum/expression-tutorials/">Expression Tutorials</category>
			<dc:creator>Whosdr</dc:creator>
			<guid isPermaLink="true">http://www.wiremod.com/forum/expression-tutorials/22107-whosdrs-game-tutorials.html</guid>
		</item>
	</channel>
</rss>
