Friday, May 28, 2010

Quick REBOL Game-intro

Nick over at the REBOL Forum mentioned that he had written a short tutorial for game maker wannabees. Of course we all want to write games in REBOL , no matter how old we are.
So here is the link for the intro!!

Keep coding

Tuesday, May 18, 2010

Five sconds of REBOL - dialogs & functions

REBOL has a lot of built in functions and dialogs. I've already tried out "alert", but there are a lot more, like these:

request-pass
request-date
request-color
request-file

These functions has different options specified by the "/" symbol. For example "title".

request-pass/title "Logon to the secret chamber"

Also notice that they have return values. To make a simple question/answer dialog try the following:

name: request-text/title "What is thy name?"
alert (rejoin ["Hello there " name])

The return value of the reuqest-text function is stuffed into the variable "name" and shown in the alert using the "rejoin" function that simply concatenates text.

So remember, dialogs have options and variables are declared using the ":" symbol!






Monday, May 10, 2010

Shaping up the REBOL fonts

As mentioned before, the default font in the REBOL gui didn't make wanna cheer out loud. Lucky me, there was an answer to that problem also.
Find the file "user.r" - this file contain all your user defined settings and will survive upgrades. (rebol.r won't - don't use it for your homebrewed stuff )
In windows7 I managed to find it in "C:\Users\elwis\AppData\Roaming\rebol", open it up and add these lines at the end of it:

set-default-font: func [
"sets default font for /View"
font-blk [block! word!] "block of font attributes"
][
system/standard/face/font: make system/standard/face/font font-blk
system/view/vid/vid-face/font: make system/view/vid/vid-face/font font-blk
foreach [w s] system/view/vid/vid-styles [s/font: make s/font font-blk]
]

Watch that linebreaks will you.
Now you can add the following to all your REBOL scripts and watch the joy of nice looking fonts.
set-default-font
[
name: "tahoma"
style: none
size: 12
color: 0.0.0
offset: 2x2
space: 0x0
align: 'center
valign: 'center
shadow: none
]
For example, this simple little script will now create a much nicer gui.
Rebol [
Title: "Set variable"
]
set-default-font
[
name: "tahoma"
style: none
size: 12
color: 0.0.0
offset: 2x2
space: 0x0
align: 'center
valign: 'center
shadow: none
]
view layout [
f1: field
btn 100x25 "Display Variable" [

t: f1/text

f2/text: t
show f2
]
f2: field
]

Over and out fellow developers


Things I learned day one with REBOL

My first day of REBOL gave me a few gotchas.

First of all, I noticed that google didn't handle me that many pages when searching for questions regarding REBOL. There are not much "buzz" about it at all around the web, and I found at that the main reason for that is probably because the REBOL people hang around in something called AltME world, not ordinary forums. (There are at least one forum for you all to check out).

Second, REBOL gui's isn't the most beutiful in the world for sure, but they are probably the easiest ever to create. Python is compact but type this is in you REBOL console and be amazed..

editor (request-text)

Anyway, I always prefer Function over Form, and hopefully I will discover a few tricks to make the gui look a little bit better, like a new font.

And finally a notice, if you play with the REBOL console you can type away whatever examples you find. But remember that if you write REBOL scripts (.r files) you will always need a valid REBOL header, like this one:

Rebol [
Title: "Cool REBOL script"
]

By the way, if your'e on windows and in the need for a REBOL editor, read this post.

REBOL, the beginning

First of all, extremely short facts about REBOL ..

REBOL (Relative Expression Based Object Language) is a programming language designed by Carl Sassenrath, the man behind AmigaOS. It was first released in 1997 and is extremely lightweight and cross-platform.

So, why would I care for REBOL? I, by the way, am an aging software developer with a love for the penguin OS and opensource, and are old enough to remember when KDE 1.0 where unstable.
I will care - because I am extremely curious, I've played around with a lot of languages (but get my paycheck for doing Java & C#) but have to admit I never saw anything like REBOL. That is why I plan to play around with it some more, and report whatever strange enlightenments I will receive.

For starters - get REBOL from here, installation on windows is only a matter of running the exe file. (On windows 7 - I did have to do it as an administrator though).
For Ubuntu, it seem to be a little bit more troublesome. I have only tried it once on Ubuntu 10.04 during lunchbreak. The REBOL Desktop segfaulted upon me but the console and the script seem to work. I'll dig deeper into that later, so if patience isn't one of your virtues go ahead and give the tar.gz file a shot.

When REBOL is installed, fire up the Rebol console and start playing, why not with the traditional

alert "Hello world"

Now.. with that out of the way, stay tuned...