Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: Rubble v3.13 (for 34.11) - Minor bug fixes!  (Read 15772 times)

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Rubble v3.13 (for 34.11) - Minor bug fixes!
« on: July 02, 2013, 11:12:28 am »

Rubble: After Blast comes Rubble

==============================================
Overview:
==============================================

Rubble is a raw generator, eg. it takes "preraws" and generates Dwarf Fortress raw files from them.

By using "templates" (either predefined or defined yourself) you can greatly simplify the task of writing a Dwarf Fortress mod.
For example, there are templates that automate registering workshops and reactions, which will not only save you time but also reduce the chance of bugs as well.

For non-modders Rubble makes it easy to install mini-mods so you can create your perfect custom Dwarf Fortress.

Required Reading for Modders (in most-important-first order):
   This readme
   HowTo Rubble - Tutorials
   Rubble Addons - Lots of stuff about addons in general
   Rubble Base Templates - The template documentation for the "Base/Templates" addon
   Rubble Native Templates - The template documentation for the built-in templates
   Rubble Libs Templates - The template documentation for the library templates
   The included addons - A little short on comments but still a great resource
   Raptor Basics - Raptor overview
   Everything in "raptor command docs" - the Raptor command documentation, NEEDED if you plan to do anything with Raptor

If you do not plan on doing any modding the only thing you need to read is this readme.

==============================================
Install:
==============================================

Backup your "raw/objects" folder! Rubble will delete all your existing raw files!
Extract Rubble to "<DF Directory>/rubble".
Install your addons to "<DF Directory>/rubble/addons"
(If you use DFHack) add "script rubble.dfhack" to your dfhack.init file, this step is VERY IMPORTANT for DFHack users!
Run "rubble -addonlist" OR run "Rubble GUI.exe"

Now you are good to go! Documentation is in the "rubble/other" folder as is source code and OSX/Linux binaries.

To activate or deactivate a Rubble addon you may set it's entry in addons/addonlist.ini to "true" or "false". If you just added an addon it will not have an entry until Rubble has run at least once (after the addon was added).
If you want to run Rubble without generating anything so as to update the addon list file just run 'rubble -addonlist'

If you can (eg. you are running on windows) it is HIGHLY recommended to use the GUI. The GUI automates the process of updating and editing addonlist.ini and is generally much faster then doing everything by hand (plus you don't have to mess around with the command prompt, if you dislike that kind of thing)

If you want to run multiple worlds with radically different addon sets it is HIGHLY recomended to run "rubble -prep=<region name>" before switching worlds!

If you use OSX or Linux, 32 bit binaries for these OSes can be found in the "rubble/other" directory. If you want 64 bit binaries you can compile them yourself, source code is in other/src (along with basic build instructions).

==============================================
Configure:
==============================================

Rubble allows you to change its settings via command line options or a config file. To see these options and their defaults run "rubble -h".

ALL command line options may also be specified in the config file.

Rubble tries to read the file "./rubble.ini", if this does not fail Rubble will load settings from here before processing command line options (command line options always take precedence).
Example "rubble.ini" (using some of the defaults):
   [rubble]
   dfdir = ..
   outputdir = ../raw/objects
   addonsdir = ./addons

Rubble supports external launchers via the -config and -addons command line options
-config allows you to set/create rubble variables.
   Usage: -config="key1=value1;key2=value2;keyN=valueN"
      (Note that the ';' may need to be a ':' on non-windows systems)
-addons allows you to override the default rules for loading addons by explicitly listing which ones you want to load.
   Usage: -addons="addon1;addon2;addon3;ect"
      (the same note about ';' applies here as well)
These two options are mostly for use by external launchers.

If you want to regenerate the raws for a save just run 'rubble -outputdir="../data/save/<savename>/raw/objects"'

All directories used by Rubble must exist (you should get an error message if not).

==============================================
Included Addons:
==============================================

I include addons in the base Rubble install that fix bugs, demo something useful, or are just too useful to leave out.
Needless to say these addons make a good place to look for info on how to do something.

If you want to generate the Rubble version of "vanilla DF" you will need to activate the "Base/Files", "Base/Templates", and "Base/Clear" addons, these addons are already active in the default addonlist.ini.

Spoiler (click to show/hide)

==============================================
BUGS (and other issues):
==============================================

Known Issues (non-bug):
   
   You should not use the extension .txt for readme files, as this will cause Rubble to parse those files.
      See "Rubble Addons.txt" for more details.
   
   It may be possible to see FBs made from "dfhack command" or "caste transformation", there is nothing I can do about this as autosyndrome requires the use of inorganic materials.

When making an error report please post the FULL log file! Posting just a few lines tells me almost nothing about the problem, after all I made Rubble write all that stuff for a reason :)

If any of the documentation is not 100% clear just ask.
I know everything there is to know about how Rubble works and so I tend to forget to put
"obvious" stuff in the docs. A reminder that I forgot something is more a help than a hindrance.

==============================================
Changelog:
==============================================
Spoiler (click to show/hide)

Download (at DFFD)
« Last Edit: April 09, 2014, 03:53:20 pm by milo christiansen »
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile

<redacted because not nice>
« Last Edit: June 15, 2014, 09:58:03 am by MagmaMcFry »
Logged

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile

As for the competition, a little back and forth should make us all stronger ;) Just remember that a lot of templates are going to change at some point.

Thanks for the report. As for SET leaking stuff all over the cause is a little hard to explain but obvious once you know how NCA4 handles return values. The junk you are getting is because I forgot that I needed to clear the return register, as the command that sets a variable's value returns "unchanged" aka whatever the previous command returned.

One of the dumb bugs that I still need to fix. Now that I think about it I forgot to test SET (as well as a few other templates) after I ported them to NCA, oops.

One other bug that may cause some of that stuff is that i used SCRIPT where I should have used !SCRIPT or #SCRIPT The following replacement for "raw/source/base/base_templattes.txt" should fix those errors (as well as the SET error).
Code: [Select]
'Templates used in the base

Note that to keep the output properly formatted templates often have ugly indentation'

'The comment templates, very simple, just do nothing.'
{!TEMPLATE;COMMENT;}
{!TEMPLATE;C;}

'VOID, a little more complicated, this is a prime example of using ...'
{!TEMPLATE;VOID;
{SCRIPT;
(foreach params {
'Note that params here is NOT the same map as the one passed to foreach'
(rubble:stageparse [params 1])
(break -1)
})
(ret "")
;...}
}

'PANIC, cause Rubble to exit with an error, not used in the base.'
{!TEMPLATE;!PANIC;msg;
{!SCRIPT;(panic (rubble:expandvars {%msg}))}
}
{!TEMPLATE;PANIC;msg;
{SCRIPT;(panic (rubble:expandvars {%msg}))}
}
{!TEMPLATE;#PANIC;msg;
{#SCRIPT;(panic (rubble:expandvars {%msg}))}
}

'The next two templates are for stripping leading/trailing whitespace from a string.
A formatting tool mostly, helps keep whitespace under control in generated files.'
{!TEMPLATE;ECHO;
{SCRIPT;
(var tmp)
(foreach params {
(set tmp (append [tmp] [params 1]))
})
(ret (rubble:stageparse [tmp]))
;...}
}
{!TEMPLATE;E;{ECHO;...}}

'SHARED_OBJECT and SHARED_ITEM. SHARED_ITEM will be removed as soon as I get around to it.'
{!SCRIPT;(map "rubble:shared_object_data")}
{!TEMPLATE;SHARED_OBJECT;id;raws;
{SCRIPT;
(if (eq [rubble:shared_object_data {%id}] "ok"){
(rubble:stageparse {%raws})
(ret "")
}{
(set rubble:shared_object_data {%id} "ok")
(ret (rubble:stageparse {%raws}))
})
}
}
{!TEMPLATE;SHARED_ITEM;id;raws;{SHARED_OBJECT;%id;%raws}}

{!TEMPLATE;IF;a;b;then;else;
{SCRIPT;
(if (eq {%a} {%b}){
(ret {%then})
}{
(ret {%else})
})
}
}

{!SCRIPT;(map "rubble:once_data")}
{!TEMPLATE;ONCE;id;raws;
{SCRIPT;
(if (eq [rubble:once_data {%id}] "ok"){
(ret "")
}{
(set rubble:once_data {%id} "ok")
(ret (rubble:stageparse {%raws}))
})
}
}

{!SCRIPT;(map "rubble:static_data")}
{!TEMPLATE;STATIC;id;raws;
{SCRIPT;
(if (exists rubble:static_data {%id}){
(ret [rubble:static_data {%id}])
}{
(set rubble:static_data {%id} (rubble:stageparse {%raws}))
})
}
}

{!TEMPLATE;SET;name;value;
{SCRIPT;
(rubble:setvar {%name} {%value})
(ret "")
}
}

{!SCRIPT;(var "rubble:adventure_tier_data" -1)}
{!TEMPLATE;#ADVENTURE_TIER;
{#SCRIPT;
(set rubble:adventure_tier_data (add [rubble:adventure_tier_data] 1))
(ret [rubble:adventure_tier_data])
}
}

{!TEMPLATE;!PRINT;
{!SCRIPT;
(foreach params {
(console:print "\t" [params 1] "\n")
(break -1)
})
(ret "")
;...}
}
{!TEMPLATE;PRINT;
{SCRIPT;
(foreach params {
(console:print "\t" [params 1] "\n")
(break -1)
})
(ret "")
;...}
}
{!TEMPLATE;#PRINT;
{#SCRIPT;
(foreach params {
(console:print "\t" [params 1] "\n")
(break -1)
})
(ret "")
;...}
}

{!TEMPLATE;SHARED_INORGANIC;id;raws;
{SCRIPT;
(append
"{SHARED_OBJECT:" {%id} ";\n"
"[INORGANIC:" {%id} "]\n\t"
(rubble:stageparse {%raws})
"{#_REGISTERED_ORES;" {%id} "}"
"{#_REGISTERED_REACTION_CLASSES;" {%id} "}"
"{#_REGISTERED_REACTION_PRODUCTS;" {%id} "}"
"\n}"
)
}
}
{!TEMPLATE;SHARED_MATERIAL_TEMPLATE;id;raws;
{SCRIPT;
(append
"{SHARED_OBJECT:" {%id} ";\n"
"[MATERIAL_TEMPLATE:" {%id} "]\n\t"
(rubble:stageparse {%raws})
"{#_REGISTERED_ORES;" {%id} "}"
"{#_REGISTERED_REACTION_CLASSES;" {%id} "}"
"{#_REGISTERED_REACTION_PRODUCTS;" {%id} "}"
"\n}"
)
}
}

'This is used for generic animal mats'
{!TEMPLATE;ANIMAL_MAT;
{IF;$GENERIC_ANIMAL_MATS;YES;
CREATURE_MAT:ANIMAL
;
LOCAL_CREATURE_MAT
}
}

{!TEMPLATE;#AQUIFER;
{IF;$USE_AQUIFERS;YES;
[AQUIFER]
;
Aquifer Disabled
}
}

'An evil hack to make declaring items easy.'
{!TEMPLATE;BASE_ITEM;type;item;def;
{SHARED_OBJECT;%item;
{ITEM;%type;%item;%type}
%def
}
}


{!SCRIPT;(map "rubble:tile_data")}
{!TEMPLATE;SET_TILE;id;tile;
{SCRIPT;
(if (exists rubble:tile_data {%id}){
}{
(set rubble:tile_data {%id} {%tile})
})
(ret "")
}
}
{!TEMPLATE;#TILE;id;default;
{#SCRIPT;
(if (exists rubble:tile_data {%id}){
(ret [rubble:tile_data {%id}])
}{
(ret {%default})
})
(ret "")
}
}

'This tells Rubble to only read this file on the first pass and to not write it to disk.'
{!SCRIPT;(rubble:skipfile "base_templates")}

A fix for variable expansion woes is comming in the next version. I should have thought of that problem myself :(
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile

Updated to 1.4- see first post.

Changelog highlights:
Variable expansion is fixed
NCA updated to version 5
lots of template bugs fixed, some small some large
Added support for tilesets
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile

Code: [Select]
test_file

--1

--2
[DESCRIPTION:A [i]real[/i] small furry creature from Alpha Centauri.]
--3

--4

  [DESCRIPTION:A small furry creature from Alpha Centauri.]
--5
Nope, still not working.
Logged

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile

That is correct behavior, variables outside of templates are expanded last, AFTER the post parsing pass. Variables inside of a template body are expanded before the template is parsed. To fix your template you would need to suround the variable with an ECHO template like so:
Code: [Select]
--1
{SET;DESC;A small furry creature from Alpha Centauri.}
--2
[DESCRIPTION:{E;$DESC}]
--3
{!TEMPLATE;SET_AND_WRITE_DESC;desc;
  {SET;DESC;%desc}
  [DESCRIPTION:{E;$DESC}]
}
--4
{SET_AND_WRITE_DESC;A [i]real[/i] small furry creature from Alpha Centauri.}
--5
Most of the time variables are not used outside of templates or inside of template bodies where this would be a problem, variables are mostly for settings and the like, if you want to do anything complicated it is better to use NCA.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile

Updated to 1.5

Changelog highlights:
NCA much improved
All templates except the unportable ones are ported to NCA
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile

1.6 is almost done. Highlights will be MUCH better tileset support and NCA v6

Tileset support will be automatic in that all the SHARED_XXX templates (except SHARED_OBJECT) will automaticly wrap tile numbers and colors in the correct template calls. One problem is that plant raws with embeded materials will not extract the material tags, sorry no good way to do that, you'll have to wrap those manually.

NCA6 adds better script value support for native commands, this allows me to add more powerful commands and provide better Indexable support as well as having more internal types for faster math (no more converting to/from string all the time, floating point support possible)

Script debugging will be MUCH easier as I have added a ncash command. Calling ncash will start a slightly nerfed version of NCASH6 allowing you to examine the environment at the point it was called as well as run any debuging code you want before exiting and allowing Rubble to continue.

Look for the update sometime next week.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Rubble v1.6 - After Blast comes Rubble - Now with FULL tileset support!
« Reply #8 on: August 21, 2013, 02:45:47 pm »

I have version 1.8 almost ready to ship, just a few script related things to finish up first. (1.7 got skipped, I was finished and had it all packed up when I had a "strange mood" and finished off NCA7, which adds so much cool stuff that shipping a 1.7 with a 1.8 to follow very soon seemed to be a waste)
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Rubble v1.8 - Now with even better script support!
« Reply #9 on: August 23, 2013, 02:20:33 pm »

Version 1.8 is up!

Changelog highlights:
Finally added support for a config file
Updated to NCA7, this included many, many, changes to the script runtime (I rewrote it almost from scratch). A bunch of commands are now namespaced/renamed and there is support for "object literals". All these changes make NCA even easier to use.
Added a template for addon hooks.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Taverius

  • Bay Watcher
  • Curly says go!
    • View Profile
Re: Rubble v1.8 - Now with even better script support!
« Reply #10 on: September 07, 2013, 09:46:51 am »

This is confusing me:

Quote
{#WRITE_TILESET;<PATH>}
    Write calls to SET_TILE and SET_COLOR for all calls to #TILE and #COLOR to file <PATH>.
    This should only be used once to get a template for making a tileset addon, it has no other use.
    Note that for this to work #WRITE_TILESET MUST be called AFTER every call to #TILE or #COLOR!

It only needs to be called once, but it needs to be called after every #TILE/#COLOR call?

... huh?
Logged
The early bird gets the worm, but the second mouse gets the cheese.

Taverius

  • Bay Watcher
  • Curly says go!
    • View Profile
Re: Rubble v1.8 - Now with even better script support!
« Reply #11 on: September 08, 2013, 02:20:22 am »

Code: [Select]
Error: Script Error: Invalid Token: Found: TknCmdEnd. Expected: TknString or Tkn
CmdBegin or TknDerefBegin or TknObjLitBegin. On Line: 50 Column: 3.
Near line: 8 In last file
Was just trying it out with the broken arrow addon enabled.
Logged
The early bird gets the worm, but the second mouse gets the cheese.

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Rubble v1.8 - Now with even better script support!
« Reply #12 on: September 13, 2013, 01:48:40 pm »

Sorry if I am a little late, I don't visit the forums much :(

#WRITE_TILESET is something of a special command. It should only be used to generate a tileset file, and so is ment to be added to the last file processed temporarily. As its description says it writes (to the file name passed as a param) a call to SET_TILE or SET_COLOR for ever call to #TILE or #COLOR that exists in the raws.

As for your error... That is a script error, eg it was caused by NCA. This appears to be a syntax error, but if you were using the vanilla base and addons it is more likely to be a goof on my part. When I get home I'll take see if I can reproduce the error and see what is wrong. Look for more info after 2 pm monday.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Rubble v1.9 - Now with bug fixes!
« Reply #13 on: September 16, 2013, 03:23:01 pm »

Rubble 1.9 uploaded.

Change log highlights:
Fixed ITEM_CLASS
The Rubble windows binary now has an icon!
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Rubble v2.0 - Now with tweak scripts!
« Reply #14 on: September 26, 2013, 04:44:00 pm »

Rubble 2.0 uploaded.

This was going to be version 1.10 but then I added Tweak Scripts. Tweak scripts are the bigest thing to happen to Rubble since the SCRIPT template, basicly they are small NCA scripts that run before or after generation, thereby allowing you to "tweak" the raws.

A little hard to explain, take a look at the included addons, they ALL use tweak scripts for one thing or another.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS
Pages: [1] 2 3