Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

BOF Tools 1/Redstone

Newbie Spellweaver
Joined
Jun 24, 2006
Messages
42
Reaction score
0
I'm releasing the BOF compiler (Redstone) in the state it is now, because I'm getting demotivated. The archive includes the most recent versions of each tool, and a grammar summary for the Redstone language. The major changes are:

- The inclusion of the compiler in bofmake
- bofmake now only processes files ending in .bc (for assembly with the assembler you've been using) and .red (for compilation with the new compiler).
- bofmake does not recursively traverse subdirectories when looking for source files.
- "this" is now "self".
- bofmake now only generates one .rsc file for the server resources, which is identical to the .rsb file generated for the client.

I didn't finish with pattern matching.

It would be inconvenient if, in order for you to use the new compiler to make changes to a disassembled class, you had to rewrite all the code in the class in the Redstone high-level language - even in messages which you don't wish to modify. Therefore, I have provided a facility that allows you to rewrite bytecode one message at a time. In a .bc (bytecode) file, the statement compile {CODE} causes the assembler to invoke the compiler to process the text CODE. CODE should contain a single Redstone-style message definition. This is in some sense the opposite of inline assembly ;)

There is a problem in the blakston.khd everyone has been using: several constants are defined in terms of others using operations such as / (division). The Renaissance server ignores these operations completely, and simply takes the first term of the operation as the final value. I have replaced the bad constants in blakston.khd with the correct values (by just manually evaluating the problematic expressions). That file is also included.

Because Redstone allows you to reference admin constants, a new line must be added to project.txt: "constants:". This specifies the filename of the constants file. A sample project.txt is also included.

Those looking for information on the assembler and Renaissance interpreter, try here http://forum.ragezone.com/f203/bof-tools-testing-238897.

Finally, some examples... nest1.red:
Code:
requires monsroom

class SpiderNest1 : MonsterRoom
	static vrName = res room_name_nest1
	static viTeleport_row = 32
	static viTeleport_col = 7
	static viTerrain_type = TERRAIN_CAVES | TERRAIN_LAIR
	private prRoom = res room_nest1
	private piRoom_num = RID_NEST1
	private prMusic = res nest1_music
	private piBaseLight = 124
	private prBackground = res background_mountains
	private piMonster_Count_Max = 10
	private piGen_time = 20000
	private piGen_percent = 60
	private ptQueen_gen = nil

// This is a comment.
message Delete =
  if ptQueen_gen <> nil then
    (delete_timer(ptQueen_gen);
    ptQueen_gen := nil);
  continue

message SomethingMoved(what = nil, new_row = nil, new_col = nil) =
  if new_row = 26 and new_col = 16 then
    (SYS.UtilGoNearSquare(what = what, where = SYS.FindRoomByNum(num = RID_CAVE2),
      new_row = 53, new_col = 14, new_angle = what.GetAngle, fine_row = 16, fine_col = 16);
    what.MsgSendUser(message_rsc = res Nest_to_Cave_2);
    return nil);
  if new_row = 2 and new_col = 19 then
    (SYS.UtilGoNearSquare(what = what, where = SYS.FindRoomByNum(num = RID_CAVE2),
      new_row = 50, new_col = 25, new_angle = what.GetAngle);
    what.MsgSendUser(message_rsc = res Nest_to_Cave_1);
    return nil);
    continue

message Constructed =
  plMonsters := [[class SpiderBaby, 80], [class Spider, 20]];
  plGenerators := [
    [ 8, 22], [27, 22], [22, 19], [19, 20],
    [31, 15], [36, 11], [30,  2], [35, 19],
    [19, 25], [15, 24], [24,  8], [23,  2],
    [ 4, 13], [15, 16], [ 2, 12], [13,  5],
    [ 9, 15], [ 5, 11], [17,  5], [20,  8],
    [28, 12], [35, 16], [25, 24], [31, 10],
    [34,  7], [ 4, 23]];
  self.QueenGenTimer;
  continue

message QueenGenTimer =
  ptQueen_gen := nil;
  queen_alive := FALSE;
  for each object in plActive do
    if self.HolderExtractObject(data = object) : SpiderQueen then
      (queen_alive := TRUE; break);
  if not queen_alive then
    self.NewHold(what = new SpiderQueen, new_row = 21, new_col = 15);
  ptQueen_gen := make_timer(self, QueenGenTimer, 3600000);
  nil

A1.bc (note that use of compile to have the compiler process the Constructed message):
Code:
requires feyforst

class OutdoorsA1 : FeyForest
    static vrName = res room_name_OutdoorsA1
    static viTeleport_row = 32
    static viTeleport_col = 32
    private prRoom = res room_OutdoorsA1
    private prMusic = res OutdoorsA1_music
    private piRoom_num = 511
    private piGen_time = 150000

message CreateStandardObjects, 1 local
    new     class FeyTree, #local0
    send    self, msg NewHold, [what = #local0, new_row = 43, new_col = 26]
    new     class FeyTree, #local0
    send    self, msg NewHold, [what = #local0, new_row = 45, new_col = 24]
    new     class FeyTree, #local0
    send    self, msg NewHold, [what = #local0, new_row = 47, new_col = 31]
    new     class FeyTree, #local0
    send    self, msg NewHold, [what = #local0, new_row = 21, new_col = 46]
    new     class FeyTree, #local0
    send    self, msg NewHold, [what = #local0, new_row = 24, new_col = 42]
    new     class FeyTree, #local0
    send    self, msg NewHold, [what = #local0, new_row = 37, new_col = 42]
    new     class FeyTree, #local0
    send    self, msg NewHold, [what = #local0, new_row = 37, new_col = 36]
    cont

compile {message Constructed =
  // Blah!
  plGenerators := [[11, 32], [16, 15]];
  continue}

message CreateStandardExits, 1 local
    mov     nil, plEdge_Exits
    list    4, 531, 6, 1, 8, #local0
    cons    #local0, plEdge_Exits, plEdge_Exits
    cont

As before feel free to ask questions, especially since the documentation is quite lacking.
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Nov 11, 2005
Messages
78
Reaction score
0
Sweet! Finally an actual language to write bofs in!
 
Newbie Spellweaver
Joined
Apr 23, 2007
Messages
34
Reaction score
0
OK, now I'm having a little problem...
I'm trying to make a new room. Or really, just make a copy of a room and name it ROFLCOPTER. I'd normally have a better name, but meh.
I copied JASAB1.bc to ROFLCOPTER.bc and changed it to read:
Code:
requires jasperrm

class ROFLCOPTER : JasperRoom
	static vrName = res room_name_JasperAB1
	static viTeleport_row = 11
	static viTeleport_col = 13
	static viPermanent_flags = 8
	static viTerrain_type = 10
	private prRoom = res room_jasperAB1
	private piRoom_num = 232
	private prmusic = res room_jaspermusic
	private piBaseLight = 164
	private piOutside_factor = 3

message CreateStandardExits, 1 local
	mov     nil, plExits
	list    12, 13, 350, 35, 22, 8, #local0
	cons    #local0, plExits, plExits
	cont
I then ran bofmake, and it seemed like it did something.
In the server, I create an admin account. Nothing is on fire yet, so it seems to be working.
Log on, create character, type go 232 and BAM! nothing happens?
Did a little looking with the admin console:
Code:
> show instances jasperab1
:< instances of CLASS JasperAB1 (16417)
: OBJECT 517
: 1 total
:>
> show instances roflcopter
:< instances of CLASS ROFLCOPTER (20034)
:
: 0 total
:>
Room isn't created, not sure why, so I create object ROFLCOPTER and it shows up, but go 232 still doesn't work... What am I forgetting?
 
Newbie Spellweaver
Joined
Dec 21, 2006
Messages
94
Reaction score
0
several things,

first of all:
Code:
requires jasperrm

class ROFLCOPTER : JasperRoom

you are making your new class a child class of jasperroom, unless this room is in jasper, you might want to change this.

Code:
	static vrName = res room_name_JasperAB1
	private prRoom = res room_jasperAB1
	private prmusic = res room_jaspermusic

create new resources even if they contain the same data as the old ones, this allows you to change the name/sounds of the room and the roo used without editing the BOF later. (and its the way its supposed to be)

when you start a server for the first time, the system object goes through a message called CreateAllRoomsIfNew, this message calls the CreateOneRoomIfNew message for each room in the game. Either add your room to the system class to be created automagically, or after your server has been started use the following admin command

Code:
send class system CreateOneRoomIfNew class class roflcopter num int 232

This should take care of it for you. Sometimes after a manual createoneroomifnew command, you need to garbage collect before you can teleport in.

Happy Coding.
 
Newbie Spellweaver
Joined
Jun 24, 2006
Messages
42
Reaction score
0
To be more clear: you created a new class but never told the interpreter to create an object of that class. Room objects are normally created by the object of System class.

It seems to be a common problem: when changes you make to the code don't have any effects, it's probably because your code isn't being executed. Find out where your code would be called from, and figure out when. Use grep.
 
Newbie Spellweaver
Joined
Jun 24, 2006
Messages
42
Reaction score
0
Syntax highlighter

This little tool formats a source file with syntax highlighting and outputs it in HTML on standard output. If someone wants to host it as a service online, I can change its I/O facilities to suit your needs - contact me.
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Jun 21, 2006
Messages
178
Reaction score
0
Re: Syntax highlighter

This little tool formats a source file with syntax highlighting and outputs it in HTML on standard output. If someone wants to host it as a service online, I can change its I/O facilities to suit your needs - contact me.

I can host it on my site if you don't mind
 
Newbie Spellweaver
Joined
Jun 24, 2006
Messages
42
Reaction score
0
Of course. PM me how you intend to send it source from your script.
 
Newbie Spellweaver
Joined
Jun 24, 2006
Messages
42
Reaction score
0
Highlighter

An updated version of the highlighter. It can be accessed at (thanks Daenks!!). You can paste code examples there or whatever else you need.
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Nov 11, 2005
Messages
78
Reaction score
0
I've been trying to convert many of my bc to red, and I need some help with "addp". I've tried add_packet the compiler says I need a ">". Also how do I use debug.

*edit* okay got some of it to work. Could I see examples of add packet?
 
Newbie Spellweaver
Joined
Jun 24, 2006
Messages
42
Reaction score
0
I realized right after uploading the compiler that I forgot to implement any way to generate addp. And it was a nice, quiet, and lazy few months before you posted ;)

I'll add it in a few days and post a new version.

W.r.t. to debug, I'm assuming that's what you got to work.
 
Newbie Spellweaver
Joined
Nov 11, 2005
Messages
78
Reaction score
0
heh, thanks. :p

I got debug to "work" but it doesn't display the message.
Am I doing this right?

debug>("test")

I really doubt it, could you also explain how to use it?
 
Newbie Spellweaver
Joined
Jun 24, 2006
Messages
42
Reaction score
0
Why the '>' character? debug("test") should do it.

I'm not sure why the compiler told you that you need > (after add_packet, though, as you said a few posts above), I'll check it out when I get back to my computer in a day or two.

In any context, that string should result in code that executes debug with no arguments, then compares the result of debug (nil) with the value of the debug string "test" using gt. In other words, something like

debug #local0
gt #local0, "test"

Where #local0 in the debug operation is a destination operand. IIRC, it's not actually possible to have a destination operand in the debug instruction in the assembler, but I'm not sure why anyone would ever want one - the result is always nil.
 
Newbie Spellweaver
Joined
Nov 19, 2007
Messages
5
Reaction score
0
When I try to debof I always get an eror opening the kodbase.txt file.
Any ideas?
 
Newbie Spellweaver
Joined
Dec 21, 2006
Messages
94
Reaction score
0
somtimes the -k parameter needs a DIRECTORY sometimes it needs a FILE, read the docs :)
 
Back
Top