Re: Offline Builder

From: Patrick Dughi (
Date: 11/11/00

> >        You know, if we really wanted to make an easy to modify offline
> >builder with an internal gui editor-editor (ie, place/display new buttons
> >on the screen, etc) - we could just do it in perl/tk.  Good for windows.
> >Good for Xwindows.   Also very easy to do.
> I haven't had a chance to learn perl yet.  As for tcl/tk, I really
> didn't like what I've seen of it, although that was at least 4-5 years
> ago.  An editor-editor arrangement would probably be easier for
> builders/coders to learn than my first attempt at a scripting
> language, for sure :)

        Heh. actually - perl/tk is not two different subsets of languages.
It's one language altogether.  Well, it's actually just a perl module, but
still.... Installation is easy, for windows; grab the active perl install
from, and then after it's installed run ppm, and
download the 'Tk' module (case sensitive).  PPM downloads & installs at
the same time.  Then a program to create a simple window:

-- hello world w/ a button --
use Tk;

my $main = new MainWindow;

$main->Label(-text => 'Hello World!'
$main->Button(-text => 'Quit',
              -command => sub{exit}

        If you want to see an example of a short (50K) fully functional
perl/tk program, download kugel, from uh.. the sunsite linux games
selection (runs in windows, btw).

perl/tk faq is at;

        Whoa. I'm a running ad for perl/tk.


        You - the one with xapobjs! Here's a quick addon;

Edit utils.h - search for get_filename() and add a new file-type define
for use with get_filename.  Call it REIMB_FILE.  Now, edit get_filename in
utils.c and add that type. put it in the plrobjs dir, with extension

        Go though your objsave.c file.  Everywhere that it checks
} else {

        and change it so that if xap_objs == 1, get the filename for new
obj_files, if xap_objs == 2, use REIMB FILES, else old (binary)

        What you just did, was set up the save system so if you have
xap_objs == 2, your ascii file saves with a .reimb file instead of the
normal.  However, xap_objs is never set to 2.

        So you write the code for it - but you only want it like that for
the duration of one players load - so... change the save command so it
accepts an argument of "reimb" (ie, you must type "save reimb" to save a
reimb file).  There is no, and never will be any good way to automatically
generate reimb files.  Let the players be responsible for it.

        When they do, directly after the Crash_crashsave call, add;

  xap_objs_backup = xap_objs;
  if(reimb) {
    xap_objs = 2;

        Then, all you need is a imm-only command to load someone's eq.

ACMD(do_reimb) {
  struct char_data *vict;
  int xap_objs_backup,i;
  extern int xap_objs;

  one_argument(argument, arg);

  if (!*arg) {
    send_to_char("Who do you want to reimb?\r\n", ch);

  if (!(vict = get_char_room_vis(ch, arg))) {
    send_to_char("They aren't here.\r\n", ch);
  if (GET_LEVEL(ch) < GET_LEVEL(vict))  {
    send_to_char("You mayn't.\r\n",ch);
  for (i = 0; i < NUM_WEARS; i++) {
    if (GET_EQ(vict,i))
      send_to_char("The target char must not have any equipment or
inv.\r\n", ch);
        send_to_char("(Target has equipment still)\r\n",ch);
  if(vict->carrying) {
    send_to_char("The target char must not have any equipment or
inv.\r\n", ch);

        /* actually, crash_load_xapobjs uses somewhat random return codes.
            Better set them for your own system, else even a good reimb
                will say it's an error */

  if(Crash_load_xapobjs(vict)) {
    send_to_char("There was an error with that persons reimb
    send_to_char("A reimb was attempted, but there was an error with your
  send_to_char("Reimb successful.\r\n",ch);
  send_to_char("You've been reimbed by the gods!\r\n",vict);

        Add the command, and you're done.  Note; this is not for newbies.
This is not a snippet.  This is me assuming that you know, and can do the
40-50 small steps I left out, probably without thinking about it.  Things
like resolving conflicts, or declaring functions/variables.  I give the
meat, you provide the trimmings :)

        In anycase, it works great, and makes it a good time to put in a
"you may only have a reimb in these cirucmstances" policy. (like you have
to have a reimb file less than a week old).

        Lots easier than reimbing everyone's eq manually every time
something nasty happens.


p.s.  if you are using xapobjs, don't forget to null the ex_desc's upon
load of a unique item, as per Randell Hodge's fix from last year;

Even I forgot about it, installing the patch the other day. *bonks self*

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/11/01 PDT