The Wayback Machine - http://web.archive.org/web/20080912164146/http://blog.roblox.com:80/?paged=2
June 30th 2008

Scripting With Telamon: Debugging

Howdy! Today’s article is for Roblox power users who want to learn how to develop scripts in Roblox. This is not a programming language tutorial - I will assume you know enough about Lua to look at a piece of code and guess at what it does. Rather I am going to teach you how to deal with buggy scripts and show how to debug them. Debugging in general is a mystical art - I use the word "art", which is the product of innate creative forces, in contrast to "science", which can be dissected, reduced, and taught. We’ve built some tools into Roblox Studio to help you though.

Part 1 - Mission Statement

We’re going to build a secret door. An easy way to make a secret door is to make a brick and set its CanCollide property to false. Anyone can them walk through such a brick. No. Our secret door is going to be special. It’s eventually going to guard the treasure room in my castle and it’s only going to let approved members of the Pirate Army through (Arrrrr!). Clearly we need some scripting here, me hearties.

Part 2 - Build From Simpler Pieces

When I’m making a complicated script, I try to test it as I go along. I’ve seen a lot of people in intro programming classes try to write all their code at once and then test it. This is about the most painful way to write code. Don’t do it. Instead, write the shortest bit of code that you can test. Test it. If it works, add some more stuff. Then test it. If something broke, you know where to start looking.

A more simple version of the door we want to make is a door that just turns transparent whenever anything touches it.

simpledoor1.pngGo ahead and open up Roblox Studio. Create a simple test level, like the one pictured. In my level, the first test door is red. Use the Insert -> Object menu to insert a script under your test door (when the dialog box pops up, type the word "Script"). Do yourself a favor and give the script a descriptive name like "DoorScript".

Part 3 - Power Tools

Ok, time to break out the power tools. If you have been scripting without these, I feel sorry for you. There are two that I will talk about today: the Output window and the Command toolbar. The first is by far the most useful, so I will focus on it.

To bring up the Output window, use the View -> Output menu option. This is add a window pane to the bottom of your screen. This window will show the output from your scripts while they are running. If your script has an error in it, the error will be printed here along with the line number telling you where the script broke. Let’s look at both of these right now. In your new script, paste the following code:

print("Hello world!")

for i=1,10 do
print(i)
end

script.ThisPropertyDoesNotExist = 6

As you can probably tell, this script prints "Hello world!", spits out the numbers 1 to 10 and then crashes on an error. If you press the Run button in Studio, you can see this. The output will look like this:

Tue Feb 13 15:56:07 2007 - Script Heap Stats: Max Size = 21945 bytes, Max Count = 401 blocks
Hello world!
1
2
3
4
5
6
7
8
9
10
Tue Feb 13 15:56:16 2007 - ThisPropertyDoesNotExist is not a valid member of Script - =Workspace.Script, line 7: (null)

This is telling us that line 7 of our script is bad, which is something we already knew. However, in a more complicated script, it can be very helpful to print out stuff as the script is running so that you can see where things are going wrong. It may seem obvious once I’ve said it, but if something is broken with your script, start printing stuff out - rare is the bug that will not succumb to this level of scrutiny. I once wrote an entire operating system, using only printf to debug it.

commandtoolbar.pngI started programming when I was in 2nd grade and a popular language to learn back then was something called QBASIC - some of you may know it. One feature of the QBASIC programming environment was something called the Immediate Window, which you could type code into and immediately see it execute. On occasion this can be helpful to debug a script while it is running. However, this is more for advanced users. You can bring up Roblox Studio’s equivalent of the Immediate Window by using the View -> Toolbars -> Command menu option to bring up the Command Toolbar. You can type code into this at any time and run it. For example, if you wanted to, you could type:

game.Workspace.Door.Position = Vector3.new(0,100,0)

And if you have a part named "Door" in your level, it will be immediately teleported to (0, 100 ,0) while the game is running. This is kindof arcane, but I mention it because I have found the Command Toolbar useful on occasion.

Part 4 - Simple Door Script

Here it is:

print("Simple Secret Door Script Loaded")

Door = script.Parent

function onTouched(hit)
 
  print("Door Hit")
  Door.Transparency = .5
  wait(5)
  Door.Transparency = 0

end

connection = Door.Touched:connect(onTouched)

If you have ever seriously tried to learn lua scripting for Roblox, you have looked at some Roblox scripts. The code for listening to a Touch event should look familiar. Basically I have wired up the Part.Touched event to call the onTouched function whenever the part is touched by another part. When this happens, the door will turn semi-transparent for 5 seconds. Add this to your Door script, save your map, and try it. If you touch or shoot the door, you will see a nice effect. If you have the Output Window up, you will also see a "Door Hit" message printed whenever the door is touched. If you did not see this message, you would know that the onTouch function was not being called and that you had not wired up the event handler correctly.

Part 5 - A More Complicated Door

Like I said, this is not a tutorial on actually writing code, only debugging it. So here is the finished script:

print("Advanced SpecialDoor Script loaded")

— list of account names allowed to go through the door.
permission = { "Telamon", "PirateArmy", "CaptainMorgan", "SilverShanks", "JackRackam" }
Door = script.Parent

function checkOkToLetIn(name)
for i = 1,#permission do
  — convert strings to all upper case, otherwise we will let in
  — "Telamon" but not "telamon" or "tELAMON"
  if (string.upper(name) == string.upper(permission[i])) then return true end
end
return false
end

function onTouched(hit)
  print("Door Hit")
  local human = hit.Parent.FindFirstChild("Humanoid")
  if (human ~= nil ) then
   — a human has touched this door!
   print("Human touched door")
   — test the human’s name against the permission list
   if (checkOkToLetIn(human.Parent.Name)) then
    print("Human passed test")
    Door.Transparency = .5
    Door.CanCollide = false
    wait(7)
    Door.CanCollide = true
    Door.Transparency = 0
   end
  end

end

connection = Door.Touched:connect(onTouched)

It has one bug in it. Without using the Output Window, the only thing you will be able to tell is that the script is not working. With the Output Window, the problem becomes obvious:

Advanced SpecialDoor Script loaded
Simple Secret Door Script Loaded
Door Hit
Tue Feb 13 16:44:19 2007 - Workspace.YellowDoor.DoorScript2:18: bad argument #1 to ‘findFirstChild’ (Instance expected, got string) -

Since the script prints out "Door Hit", but not "Human touched door", we know the problem is somewhere in line 18 or 19 of the code. The Output window tells us that there is a problem on line 18 - FindFirstChild is failing. Ah! That is because in Lua methods are invoked using a colon (:) instead of a dot (.) (all other languages of consequence use dots for this - curse the inventors of Lua!) Change the line 18 to be:

local human = hit.Parent:FindFirstChild("Humanoid")

simpledoor3.pngAnd you have a working secret door that can be programmed to only let in your friends. To see it in action, check out SpecialDoor’s Place. If you are a new scripter and you are looking for some projects to work on, here are some easy adaptations of this script that you could do:

 

  1. Make the door let in everyone except those people who are on a blacklist (this is the opposite of the current door).
  2. Make the door flash different colors while it is open.
  3. Make the door heal you as you walk through it.

- Telamon

AddThis Social Bookmark Button

June 24th 2008

Action Adventure Movie Contest Update

GoldenRobloxianRevealing the Golden Robloxian!  

This hat is the prize for this movie contest. Isn’t it majestic?

Read how to enter in the official contest post.

Deadline

Our Staff have already started watching the videos and are finding some really great stuff. Check out the latest videos entered. You guys are awesome!

Remember, if your video is longer than 3 minutes the staff may not watch past there - but a movie over 3 minutes still can win!

We have a lot of movies to see. So keep it interesting! The contest Closes Sunday June 29 at 6pm Pacific time (9pm Eastern). All videos must be posted by this time.

Prizes!

Two ways to win this hat!

1. There will be 5 Best Motion Picture winners for this event. There is no ranking among the five. All of them are winners!  “Production Teams” are welcome (up to three users) – all listed members of the team will win the Award Hat, and the three production members get $R 1000. A production member is someone like the director, writer and camera person.

2. From among all the movies the staff will also pick winners for special categories. The winners will receive the Award Hat and $R 1000 each. In order to win the username must be listed in the YouTube movie’s information by the person who posted the video.
Categories:
Best Actor/Actress (three of these will be chosen), Best Soundtrack, Best Camera Work, Best Costumes, Best Set Design and Best Special Effects.

There is still plenty of time to make a great movie! Talk about it and look for helpers on our ROBLOXiwood forum!

-ReeseMcBlox

AddThis Social Bookmark Button

June 20th 2008

Want to earn R$ 20,000 for doing almost nothing?

No, this isn’t a pyramid scheme or real estate scam. Roblox wants to hire a Web Developer and a Graphics & Game Guru and we want a Robloxian to recommend someone. Check out the job descriptions on the jobs section of roblox.com and see if you know anyone who would be a good fit for the positions. If you recommend someone for a position, and Roblox decides to hire your dad, friend, work colleague, grandma, or whomever else you recommend, you earn 20,000 Robux. You can finally afford that white top hat you’ve had your eye on.

But wait, there’s more! If you recommend people for both jobs, and we hire both of them, you get 40,000 Robux! Remember, you only get the Robux if we actually hire the person that you recommend, so make sure your recommendations are qualified and plentiful.

I know what you’re thinking…this sounds great, but how do I get credit for recommending a candidate? It’s simple. Just convince the potential hire to apply and have the person you’re recommending include your username in their cover letter. Happy hunting!

-BrightEyes

AddThis Social Bookmark Button

June 14th 2008

Action Adventure Movie Contest

Introducing ROBLOXiwood - Action Adventure Movie Contest #1!

ROBLOXiwood is open for business!  We’re having a movie contest to celebrate. The theme is Action and Adventure. Be sure to read all the guidelines below to make sure your YouTube movie gets entered.

An Action Adventure movie is one that has a thrills, chills, and a good story. The characters have to get into some sort of trouble and then get themselves out or be saved.  Your movie can be an original work or a scene from one of your favorite “real” movies.

Prizes!

Two ways to win!

Oscar 1. There will be 5 Best Motion Picture winners for this event. There is no ranking among the five. All of them are winners!  “Production Teams” are welcome (up to three users) – all listed members of the team will win the Award Hat, and the three production members get $R 1000.

2. From among all the movies the staff will also pick winners for special categories. The winners will receive the Award Hat and $R 1000 each. In order to win the username must be listed in the YouTube movie’s information by the person who posted the video.
Categories: 
Best Actor/Actress (three of these will be chosen), Best Soundtrack, Best Camera Work, Best Costumes, Best Set Design and Best Special Effects.

Rules

1. Create an Action Adventure ROBLOX video. All entries must be a movie/video. You can learn how to make Roblox movies from our tutorial.

2. Please make all videos suitable for viewing by kids, grandmas, school teachers, and your next door neighbor. No profanity or inappropriate images. Any video that breaks the standard ROBLOX rules will not be able to win.

3. Videos should be between 30 seconds and 3 minutes long.  Keep it short so the action doesn’t get lost in long scenes. Most of the footage should be ROBLOX related.

4. On your video page put the following information.
a. Usernames of team, Link to ROBLOX - http://www.roblox.com
b. Tags - This time we want you to use tons of tags!
    * You must put “ROBLOX” and “june-action”
    * Describe your video with three or four words
    * If you are taking a scene from a real movie, include the movie name –       otherwise, put the name of a movie that’s like yours
    * Include the names of your favorite building and modeling toys
    * Describe ROBLOX in three or four words
GO CRAZY WITH THE TAGS! Example:  ROBLOX june-action giant spider chase King Kong erector knex lego fun kids online world  

5. Contest Closes Sunday June 29 at 6pm Pacific time (9pm Eastern). All videos must be posted by this time.

6. There is no rule six!

How To Win

The winners will be chosen by the ROBLOX Team who will search for videos with all the right things. Videos must have been uploaded since the contest started (no old videos!), must have the ROBLOX link and june-action tags (and other tags), and must have your username. Most of all they must have Action and Adventure! This contest is subjective to the Team’s opinion. Not everyone will agree that your video is a winner, but we hope it is!

Extra:

Feel free to talk about your video on the new ROBLOXiwood forums and link to it.

Google videos will not be accepted. Only videos on YouTube will count for this event.

You can work in Production Teams OF UP TO 3 PEOPLE. In addition, you can list other team members for costumes, special effects, set design, acting…  List these team members on your credits. All members of a Best Picture winning team will get the Award Hat. All the team’s names must be listed on the YouTube video information.

Your movie can be longer than 3 minutes but the Staff does not have to watch the whole thing. Shorter is better!

Winners and prizes will be announced within a week of the contest close.

I can’t wait to see the exciting things you guys create!

-ReeseMcBlox

AddThis Social Bookmark Button

June 10th 2008

Funny Movie Contest Winners

The ROBLOX Staff has finally picked the winners for this contest. Yay! After much debate we decided to have 8 winning entries instead of 5. It was very hard to narrow down the choices and we just couldn’t leave some of these out.

In no particular order, the winning entries are…

Max & Bob Visit Robloxia by maxxz
Stfcrb’s Fun Time 2 by Stfcrb
NoobName Show by NoobName, Wirodeu and hugeflare
Roblox Christmas at Ground Zero by Stickmasterluke
Indiana Legocat5 And The Holy Bob by legocat5
Roblox: The Bloxxer Bunch by CobraStrike4
ROBLOX - May-Funny by Johnny2008 and Acbc
Top 10 ways to die in Roblox by Are92, Are14 and Minilandstan

Watch all the videos in this player!

Or click this link to see them all on my YouTube profile page.

Each of the players listed above will receive the video contest exclusive Security Camera hat and $R 300 split among their team. Winning video contests is the only way to get the hat. Are you bummed you did a lot of work and didn’t win? Well give it a try next time! Stay tuned for more exciting video contests to come.

-ReeseMcBlox

AddThis Social Bookmark Button

June 1st 2008

Funny Movie Contest Update 2

There are now twice as many movies posted as there were last week! This contest is going great. Please keep in mind that NO WINNERS HAVE BEEN CHOSEN, but the team has started watching the movies and taking notes. There is still more than a week to finish your videos

You can still enter by following the steps in the contest announcement post below.

Here is a scene that made us laugh in SonicBoy’s Videosonicboy.

Please note: This does not mean SonicBoy is one of the winners yet. We just liked his scene here and wanted to show it off.

The contest Closes Monday June 9 at 6pm Pacific time (9pm Eastern). All videos must be posted by then but there’s plenty of time. After it closes we will keep watching and taking notes for a while longer before declaring the winners.

There are lots of movies at the time of this post! You can check out all the entries on YouTube at this link.

-ReeseMcBlox

AddThis Social Bookmark Button

May 27th 2008

Like Clockwork

clockwork

The illustrious (and infamous!) clockwork has returned! Clockwork was one of our summer interns last year and we didn’t scar him too badly, so he decided to come back for more. We’ll be getting a couple more interns over the next couple of weeks. We’re going to put them to work cranking out great stuff for you guys, and giving me rides around the office in my wheely chair. So you guys do your part and give them all a warm welcome, and I’ll do my part and make sure the wheels on my chair are oiled up.RBXHQ

Clockwork runs ROBLOX HQ, a website chock-full of ROBLOXy goodness. He’s an accomplished 3D modeler and programmer. He starts school at Stanford this September.

- Telamon

AddThis Social Bookmark Button

May 23rd 2008

Funny Movie Contest Update

The contest is going great! Tons of people (well, a lot of people) have already posted their movies on YouTube. The contest Closes Monday June 9 at 6pm Pacific time (9pm Eastern). All videos must be posted by then but there’s plenty of time.

These are some of the videos that have been entered. No winners have been chosen yet!
Some of the entries

Security CameraYou can check out the current entries by doing this search yourself! Click here!

There is a lot of funny stuff on there. You guys are doing great! The exclusive hat prize for this contest is the Security Camera. It will not be for sale… ever!

Want to know how to enter? Please check out the rules on the previous post.

-ReeseMcBlox

AddThis Social Bookmark Button

May 19th 2008

Funny Movie Contest

We’re having a YouTube movie contest and the theme is humor. Be sure to read all the guidelines below to make sure your funny YouTube movie gets entered.

Prizes!

There will be 5 (and only 5) winners for this event. They each will receive the Video Contest exclusive hat. They will also receive $R 300. There is no ranking among the five. All of them are winners.

Rules

1. Create a humorous ROBLOX video. You can learn how to make Roblox movies from our tutorial.

2. Please make all videos suitable for viewing by kids, grandmas, school teachers, and your next door neighbor. No profanity or inappropriate images. Any video that breaks the standard ROBLOX rules will not be able to win.

3. Videos should be between 30 seconds and 3 minutes long. Most of the footage should be ROBLOX related.

4. On your video page put the following information.

5. Contest Closes Monday June 9 at 6pm Pacific time (9pm Eastern). All videos must be posted by this time.

7. Winners and prizes will be announced within a week of the contest close.

How To Win

The winners will be chosen by the ROBLOX Team who will search for videos with all the right things. Videos must have been uploaded since the contest started (no old videos!), must have the right links and tags, must have your username.

Most of all they must be funny! The ROBLOX Team will watch the highest rated and watched videos and pick the ones they think are most funny. This contest is subjective to the Team’s humor. Not everyone will agree that your video is funny, but we hope it is too!

Extra Rules:

Feel free to talk about your video on the forums and link to it. Don’t post more than once though!

Google videos will not be accepted. Only videos on YouTube will count for this event.

You can work in teams OF UP TO 3 PEOPLE. Each person in a winning team would get the hat, but the money would be split between you. All the team’s names must be listed on the YouTube video information.

If this contest goes well we may have more of them in the future. We think it’s great how many videos there are about ROBLOX. You guys are so creative!

-ReeseMcBlox

AddThis Social Bookmark Button

May 18th 2008

The Survey Is Win!

We received almost 4600 responses to the Getting To Know You survey. That’s great! Now we will be better able to understand the users. Thanks guys!

We learned some interesting things from the survey, like that most users really like chatting and playing games but not so much scripting. We will try to keep it all in mind for future updates.

We also got some great suggestions…

I would love for ROBLOX to add an options menu… for example: when you talk you can change font color, there is chat above your head when you talk, you can change the quality from high to med/low, and you can do many other option things…

You can record videos on ROBLOX when you play. I mean it would come with a built in camera!!!!

Capes for our characters!

That players could rate a place, so other people could not get fooled by the name of the place.

When in a building game, make it be able so only you can delete your stuff, so people can’t come and delete it.

Some kind of hat, shirt, T-shirt, pants gifting system. Reason: to be nice to friends. I think to make it really friendly, it should be free and not just a BC thing.

Scripts in the Catalog for easier scripting.

I believe Roblox should add new kinds of basic meshes (e.g. Wedge) and new kinds of block shapes (e.g. Cylinder) and the ability to rotate and tilt bricks.

…as well as many suggestions for various hats, faces, and other costume changes.

The following 50 users received $R 50 each. They were randomly chosen from the list of survey takers.

19945
adamnet
are745
Arlo
bluetyphoon
brandonhare
Bullet150
cheessnicker
cj1884
commanderRyne
cono1234
coolKy
damondidipoo
dannywhite4
darkzero
DDestroyer
EternalDarkness
Fr0ggez
green3
GuitarDevil
iceman1788
inferus
Iruini66
kiemaster
kirby13

Koopa234
l337
Legofreak55
Lucario4
Matto11
mitchell7194
monkey7856
nanoco1000
pein2
Pheonixflame
Redfox64
rodrigo731
Sapp
sdr24
Shocker34
speed
tmap95
tyler08
wahwah45
welexis
wicked123
xRaDoMx
yakoup
zathara9
zmandevil

-ReeseMcBlox

AddThis Social Bookmark Button

« Previous PageNext Page »