User:JulienDethurens/Guide/Introduction

From Legacy Roblox Wiki
Revision as of 09:02, 22 January 2012 by >JulienDethurens
Jump to navigationJump to search

Scripting

So you want to learn scripting. After all, that's the reason you're here, right? But, first of all, what is scripting? You probably already know it, but I'm still going to explain it.

Scripting means the same thing as programming. It is used to tell your computer what you want to do. In this case, since we're on ROBLOX, we use ROBLOX Lua, a modified version of Lua, to interact with the ROBLOX API and create awesome places for other users to play.

When you create your place, you have a vast choice of objects to use to do many things. All of these objects can do different things, and they can all be manipulated by scripting, which makes it possible to do even more things. And this is precisely what you're going to learn: how to use scripting to make your places better.

ROBLOX Lua, like every programming language, has a syntax, and libraries. In fact, pretty much everything there is in a language is its syntax and its libraries. By libraries, in this case, I mean built-in functions and everything. C++ has a syntax, and offers built-in functions and libraries. C has a syntax and offers built-in functions and libraries. Java has a syntax, and offers built-in functions and libraries. And ROBLOX Lua, too, has a syntax and offers built-in function and libraries. However, unlike C++, C and Java, ROBLOX Lua is an embedded programming language, which means it is embedded in an application. This application is ROBLOX itself.

But, what is a programming language, you might ask? Well, a programming language is a language, just like English. It's just that it is used to talk with a computer, not to talk with humans. And, you see, computers don't have a brain that can think like ours, so you're going to have problems communicating with them. They won't understand what you tell them unless you say it in a specific way.

Scripts

To script, you will need to use... scripts! You probably already know how to insert a script, but, if you don't, don't worry, I'll explain it here.

To create a script, first, you must open Roblox Studio. To do this, simplest way is to go in the start menu, click 'All programs', choose the Roblox folder and choose 'Roblox Studio'. A window should appear with a browser and everything. From there, just press CTRL+N, or go in the File menu and choose 'New'. It will open a place. From there, you can do lots of things. If you've never used the studio before, you'll find all these buttons everywhere confusing. If you're a builder, you'll find it a lot less confusing. But, don't worry, in both cases, I'll tell you what to do, so you don't get lost.

Inserting a script is simple. Just go in the Insert menu and choose 'Object...'. A window with a list of objects will appear. One of the object is called 'Script'. Select it and click 'OK'.

The script will be put in the Workspace, in the explorer. If you don't see the explorer, go in View and choose 'Explorer'.

I know I'm explaining everything, and you might already be used to the studio, but I'm still going to continue explaining everything for a while, because not everyone has used the studio before. Don't skip a section, even if you think you already know everything it contains.

You have a script. That's nice, and all, but, what to do with this script? Well, to edit a script, you first need to open it, which can be done by double clicking it. So double click the script in the explorer.

Then, the script editor will appear. It lets you edit your scripts. Personally, I use an external editor, because I don't like the built-in script editor, but since you're beginning, you should just use the built-in script editor. I'll explain more about external script editors and other subjects at the end of the book.