Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Archaegeo

Pages: [1] 2 3
1
Code Vault / Re: sefun WrapText()
« on: November 02, 2011, 04:08:09 pm »
And instead of setting tab to 4 or 5 spaces, put a nice TAB variable at the top and let folks set their own :)

2
Code Vault / Re: Improved mudconfig help
« on: November 02, 2011, 04:04:35 pm »
I did this about 3 years ago, not sure why its not been sucked in, yours or mine, either would be nice
http://lpmuds.net/smf/index.php?topic=569.0

Would be helpful for mudconfig to show the values it sets and their current status.

(Not sure if mine still valid, mudconfig prob changed or gained some more values in 3 years)

3
Lima Lounge / Re: Lima login flowpath
« on: February 19, 2008, 06:24:43 am »
Thanks for that. Ill update this shortly too with the existing player flowpath

4
Lima Lounge / Lima login flowpath
« on: February 18, 2008, 01:31:39 pm »
Lima Login Flowpath

On player connection to mud, driver calls
object connect()
in /secure/master.c
->    attempts to return the USER_OB as defined by get_player_fname() in master.c
currently this is /secure/user.c as defined in /include/mudlib.h

Driver then calls
private nomask void logon()
in /secure/user.c from its inherited file /secure/user/login.c
->    this calls login_handle_logon(INITIAL_PROMPT, 0); in login.c which handles login using a switch command

NEW PLAYER
private nomask varargs
void login_handle_logon(int state, mixed extra, string arg)
->    This handles displaying the welcome info, getting name and passwords.
Control is passed to userinfo_handle_logon() in /secure/user/userinfo.c after confirming password.

protected nomask varargs
void userinfo_handle_logon(int state, mixed extra, string arg)
->   This gathers gender, email, real name, and webpage then control is passed to sw_body_handle_new_logon() in /secure/user/sw_body.c

protected nomask void sw_body_handle_new_logon()
->   This autowiz's if that flag is set, set the players priv's, and then calls create_body() in sw_body

void create_body()
->    If races are used, this gets the list and passes control to got_entry() in sw_body to let player choose their race.

void got_entry(function when_done, string line)
->   This handles the racial select, or relists them, or provides help information on a race. control is then passed to incarnate() in sw_body.c

private nomask void incarnate(int is_new, string bfn)
->   This function does several things. First it creates a body for them based on their racial pick.
Then it calls reset_parse_info in master.c which calls parse_refresh() (Not sure what this does)
Then it has the LAST_LOGIN_D log my name and ip
Then it sets my gender in the body
Then it saves me
Then it starts my shell
Then it calls enter_game in /std/body.c
->    This sets up cmd hooks, moves me to start room (defined in /std/body/start.c), announces entrance, makes me do a look and updates my health
    Then it runs a .login script for my shell, if I am a wizard
Then it calls init_stats in the /std/m_bodystats.c
Then it saves me again
Then it calls initialize_user which is back in /secure/user/login.c which initializes channels and shows the didlog

Now I am in game in the startroom playing.

5
Dead Souls Support / Re: Instant death.
« on: January 21, 2008, 11:30:43 am »
Hi,

I am posting just because if you notice there have been over thirty views of your message but no replies. The reason is the same as always and it has NOTHING to do with you as a person, so please do not take this as an attack.

You are very honest, which is great, about your lack of experience with LPC. But then you also do a typical newbie admin thing, wanting to change core systems or implement new things.

The problem with that is that those of us who have been working with LPC for a while, over a decade in some of our cases, understand that with you're level of knowledge right now, you don't even know how to ask the right questions, much less understand what we would reply with unless we took the time to first teach you and then you took the time to grasp comprehension of the language.

To put it another way, you are right now a person who just started French (spanish, japanese, whatever) and are asking someone who speaks it natively how to write a novel without even being able to grasp grammer yet.

Again, this is definitly not a personal attack. In many cases, posts like yours never even get a response.

Take the time to learn LPC, then take the time to learn the lib you plan to code on. Help out on someone elses mud, make an area or two using the tools and standard features. Then in six months or so, think again about your desire to create the world in seven days :)

I do wish you luck, and if you choose to pursue your current course, success.

Archaegeo

6
Skylib Stuff / Re: New Skylib bundle released
« on: January 12, 2008, 09:53:06 pm »
It really appears to be Discworld, im struggling to find changes

7
Dead Souls Support / Undocumented E/S/Lfun identification
« on: January 11, 2008, 11:29:08 pm »
The following snippet of code will show you which of the funs in /secure/sefun/sefun.h are not documented via man (ie in /doc/sefuns/ or /doc/efun/all/ or /doc/lfun/all).

So out of the 270 functions in sefun.h in 2.6.2, about 150 are missing documentation (but are still useful).

Code: [Select]
int d;
string b;
string fun;
string *funs;
string *sdi=get_dir("/doc/sefun/");
string *edi=get_dir("/doc/efun/all/");
string *ldi=get_dir("/doc/lfun/all/");
string fi=read_file("/secure/sefun/sefun.h");
funs=explode(fi, "\n");
foreach(fun in funs){
   if(strsrch(fun, ";") != -1 && strsrch(fun, "//")==-1){
      b=fun[0..strsrch(fun,"(")-1];
      b=b[strsrch(b, "",-1)+1..];
      sscanf(b, "*%s",b);
   }
   if(member_array(b, sdi) == -1 && member_array(b, edi) == -1 && member_array(b, ldi) == -1){
      write(b);d++;
   }
}
write("Total: "+d);

8
Dead Souls Support / New Player Login Flowpath
« on: January 10, 2008, 05:04:29 pm »
Just cause I figure there are more folks than me out there who like to know such things, this is the flowpath a new player goes through during loing (hence where you would branch them off or change things to affect such things as racial choices, stat generation, etc).

Code: [Select]
Player Login flowpath

NEW PLAYER PATH
Driver calls connect() in master.c
/secure/daemon/master.c
object connect(int port)

Driver calls logon() in object returned by connect call
/secure/lib/connect.c
varargs static void logon(mixed foo)
static void InputName(string namen, string kill_me)
static void eventCreatePlayer(string cap)
static void ConfirmName(string ans, string cap)
static void AgeCheck(string ans, string cap)
static void CreatePassword(string pass, string cap)
static void ConfirmPassword(string control, string cap, string pass)
static void InputGender(string str, string cap)
static void InputCapName(string name, string cap)
static void InputEmail(string email)
static void InputRealName(string rname)
static void InputRace(string str)
static void cmdPick(string args)
void eventCompleteChar()
Player->SetRace(raza)
Player->SetProperty("brand_spanking_new",1)
Player->AddCurrency("silver",random(100)+57)
Player->SetRace(raza)
Player->SetPassword(Passwort)
Player->SetGender(Gendre)
Player->SetCapName(CapNamen)
Player->SetEmail(E_Mail)
Player->SetRealName(TrueName)
Player->SetLanguage("Common",100)
Player->SetDefaultLanguage("Common")
this_player()->SetWimpy(20)
this_player()->SetTerminal("ansi")
PLAYERS_D->AddPlayerInfo(Name)
static private void eventEnterGame()

9
Dead Souls Support / Re: scramble_array()
« on: January 09, 2008, 09:00:20 pm »
You might save even more if you moved away from mixed and called made a scamble_int_array, scramble_string_array, etc. Mixed has to get analyzed.

10
General / Re: Using subversion with LPC
« on: January 08, 2008, 11:04:48 am »
Yeah, we caught some of that today when liveupgrade rename'd the dir containing .svn which broke svnup for a moment, had to patch that too to copy .svn/ back to /secure/upgrades/files/

11
General / Re: Using subversion with LPC
« on: January 08, 2008, 06:10:27 am »
We now have subversion running internally to the mud with external command support.
Mactorg should be posting the howto in a couple of days.

You can
svnadd <filename> - to add a file to your revision
svnci <reason> <path> - to commit back to the repository
svnup <filename> - to checkout a file from the repository into the mud

This will let you use things like RapidSVN or TortoiseSVN (we've tried both) to edit files then use svnup to pull the edited file into the mud. Or you can edit in the mud via ed or ftp and then use svnci to push to the repository.

Its working fairly well so far. He just wants to make sure its clean and documented before releasing a full how-to

12
Code Vault / Bits - No, not the naught type
« on: January 07, 2008, 09:12:17 am »
Ok, some folks might appreciate a little example of why Bits are good to use.  The below example is for your standard room. This is not in DS, just an example, and is not public domain, but is so simple that you can make something like it without copying it.

Ok, so first I have a room.h file where I define my bits.
Code: [Select]
/******************************************************************************
File: room.h
Desc: Headers, bit, and flag settings for rooms.
******************************************************************************/

// Room bit inheritable
// The room_bits object has all room specific bit and flag settings.
#define ROOM_BITS               "/lib/room/room_bits"

// These are toggled bits for each room.  Usage is:
// void RoomBits_SetBit(int bit);   // set a bit
// void RoomBits_ClearBit(int bit); // clear a bit
// int RoomBits_TestBit(int bit);   // test if a bit is set
#define ROOM_BIT_SAFE_ROOM      0       // Room is safe: no combat, no spells
#define ROOM_BIT_INDOORS        1       // (unused)
#define ROOM_BIT_NOMOB          2       // NPC's cannot enter
#define ROOM_BIT_TUNNEL         3       // Only one player in room at a time
#define ROOM_BIT_NOSMELL        4       // Scents are not left in the room
#define ROOM_BIT_NOPRINTS       5       // No prints are left in the room
#define ROOM_BIT_NOTRACK        6       // Nothing can be tracked
#define ROOM_BIT_PRIVATE        7       // Can't teleport/trans into room
#define ROOM_BIT_NO_ATTACK      8       // Room is no attack
#define ROOM_BIT_NO_MAGIC       9       // Room is no magic
#define ROOM_BIT_NO_STEAL       10      // Room is no steal
#define ROOM_BIT_NO_SUMMON      11      // Room is no summon
#define ROOM_BIT_NO_TELEPORT    12      // Room is no teleport
#define ROOM_BIT_NO_SCRY        13      // Room is no scry
#define ROOM_BIT_SOUNDPROOF     14      // Room is cut off from lines, tells
#define ROOM_BIT_DEATH          15      // Player dies if they enter
#define ROOM_BIT_NO_AIR         16      // Gasp!  Need air to breathe!

Now that they are defined, when you create a room_bits.c that your LIB_ROOM (or base room) would inherit:
Code: [Select]
/********************************************************************
File: room_bits.c
Written By: Nevin
Desc: File to control room bit and flag settings in one location.
Much cleaner than before and provides for a standard method of
setting information for rooms.
********************************************************************/

#include <room.h>

string roomBits = "";           // room bit string var

/********************************************************************
Room Bit Code
********************************************************************/
// Sets a room bit
void RoomBits_SetBit(int bit)
{
   roomBits = set_bit(roomBits, bit);
}

// Clears a room bit
void RoomBits_ClearBit(int bit)
{
   roomBits = clear_bit(roomBits, bit);
}

// Tests a room bit
int RoomBits_TestBit(int bit)
{
   return test_bit(roomBits, bit);
}

Why create the room_bits.c? You don't have to, you can just include it in your base room, this is just for cleanliness sake.

Ok, so what do we gain by doing this? It saves a lot of memory over time, since one bit can hold 64 values (0 to 63) in just one character in the string.

Plus, in the old way, for each of the properties in rooms.h you would either need a seperate function (ie getIndeors() setIndoors() etc) or you would need to set each property (set_property("indoors",1));

By using bits though, you get one simple call to set them and one simple call to check em, and it takes up less memory and just looks cleaner. (RoomBits_SetBit(ROOM_BIT_NO_ATTACK);)

You see if a bit is set with RoomBits_TestBit(ROOM_BIT_NO_ATTACK) and you can clear it with the clear_bit call.  This also makes code a lot easier to read as well.

Just my 0.02

13
Code Vault / Census Daemon for DS
« on: January 03, 2008, 08:56:54 am »
The following code and code changes add the support of a census daemon. This will let your players know when peak usage is each day (in case they want to play when more or less players are on) and it keeps track of new users and the high usage for the mud. It prints the results in a ascii graphical format with different colors based on the total users each hour or each day.

Syntax:
census - Returns the daily usage by hour
census m - Returns the monthly usage by day
census n - Returns the names of everyone who logged on yesterday.

First is the census daemon.  Put it in /daemon/census_d.c
Code: [Select]
// Census tool.
#include <dirs.h>

int totusers();
int pending() {if(event_pending(this_object())) return 1;return 0;}
int nexttot() {add_event(base_name(this_object()), base_name(this_object()), "totusers", ({}), 300, 1);return 1;}
int lastran, lastday, maxday, halfmax;
int *daily;
int *monthly;
string *names,*newbie, *oldnames, *oldnewbie;
int forever;
void login(string name);
void newuser(string name);

int *query_daily() {return daily;}
int *query_monthly() {return monthly;}
int query_forever() {return forever;}
int query_maxday();
string *query_names() {return oldnames;}
string *query_newbie() {return oldnewbie;}

int query_maxday() {
   int *a,b,c,d;
      a=query_daily();
      for(b=0,c=sizeof(a);b<c;b++) {
      if(a[b]==0) continue;
      if(a[b] > d)
         d=a[b];
      }
      return d;
   }

string query_lastran() {return ("lastran "+ctime(lastran)+"lastday "+ctime(lastday));}

void create() {

  if(!event_pending(this_object())) {
     add_event(base_name(this_object()), base_name(this_object()), "totusers", ({}), 300, 1);
  }
  names=({});
  newbie=({});
  oldnames=({});
  oldnewbie=({});
  daily = allocate(48);
  monthly = allocate(31);
  if(file_exists(DIR_SAVE+"/usage.o"))
    restore_object(DIR_SAVE+"/usage");
  return;
}

void fix_monthly(){
    monthly = allocate(31);
    this_object()->update_usage();
    return;
}


void login(string name) {
   if(!name) return;
   if(member_array(name,names) != -1) return;
   if(!names) names = ({});
   names+=({name});
   return;
}

void newbie(string name) {
   if(!name) return;
   if(member_array(name, newbie) != -1) return;
   if(!newbie) newbie = ({});
   newbie += ({name});
   return;
}

string graph(int a) {
   string sym;
   switch(a) {
      case 20: sym = "%^BOLD%^%^RED%^*";break;
      case 16..19: sym = "%^BOLD%^%^WHITE%^*";break;
      case 12..15: sym = "%^BOLD%^%^YELLOW%^*";break;
      case 8..11: sym = "%^GREEN%^*";break;
      case 4..7: sym = "%^CYAN%^*"; break;
      case 0..3: sym = "%^BLUE%^*";break;
      default: sym =  "%^BOLD%^%^WHITE%^^";break;
   }
   return sym;
}


string display_daily() {

   string disp;
   int i,j;
   disp = "";
   i=20;
   while(i>0) {
      for(j=0;j<24;j++) {
         if(daily[j] > 3*i)
         disp += graph(i);
         else disp += " ";
         if(daily[j+24] > 3*i)
         disp += graph(i);
         else disp += " ";
         disp += " ";
      }
      disp += "\n";
      i--;
   }
   disp += "%^RESET%^";
   for(j=0;j<24;j++) {
      if(j < 10) disp += "0"+j+" ";
      else disp += "" + j + " ";
   }
      disp +="\n";
   return disp;
}

string display_monthly() {

   string disp;
   int i,j;
   disp = "";
   i=20;
   while(i>0) {
      for(j=1;j<31;j++) {
         if(monthly[j] > 3*i)
         disp += graph(i);
         else disp += " ";
         disp += " ";
      }
      disp += "\n";
      i--;
   }
   disp += "%^RESET%^";
   return disp;
}
int query_day() {
   int day;
   sscanf(ctime(time()),"%*s %*s %d %*d:%*d:%*s %*s", day);
   return day;
}

varargs void update_usage(int frc) {
    int hour, min, day;

    sscanf(ctime(time()),"%*s %*s %d %d:%d:%*s %*s", day, hour, min);
    if(min > 30 && min < 60 )  hour = hour+24;
    if(sizeof(users()) > halfmax) daily[hour]=(int)sizeof(users());
    else daily[hour]=halfmax;
    maxday = query_maxday();
    if(maxday > forever) forever = maxday;
    lastran = time();
    halfmax = 0;
    if( (time() > (lastday + 86400)) || frc) {
      monthly[day]=(int)maxday;
      maxday = 0;
      oldnames = names;
      oldnewbie = newbie;
      names = ({});
      newbie = ({});
      lastday = time();
    }
    save_object(DIR_SAVE+"/usage");
    return;
}

int totusers() {
  halfmax = sizeof(users());
  call_out("nexttot",300);
  if(time() > (lastran+1600) ) update_usage();
  return 1;
}

Next is the census command, put it in /cmds/players/census.c
Code: [Select]
/*  /cmds/players/census.c
 *  Made for Dead Souls lib
 *  Created by Archaegeo
 *  Do not remove this header
 */


#define USAGE "/daemon/census_d"


mixed cmd(string arg) {
   int *a, b, c, d, e, f, g;
   string *nm, dys;
   if(arg=="m") {
      message("info","\n"+USAGE->display_monthly(), this_player());
      c=USAGE->query_day();
      dys="";
      for(b=0;b<31;b++) {
         if((b+1)==c) {
            if(b<9) dys +="%^YELLOW%^"+(b+1)+" %^RESET%^";
            else if(b>8 && b<19) dys +="%^YELLOW%^"+(1)+" %^RESET%^";
            else if(b<29) dys +="%^YELLOW%^"+(2)+" %^RESET%^";
            else dys +="%^YELLOW%^"+(3)+" %^RESET%^";
         }
         else {
            if(b<9) dys +="%^RESET%^"+(b+1)+" ";
            else if(b>8 && b<19) dys +="%^RESET%^"+(1)+" ";
            else if(b<29) dys +="%^RESET%^"+(2)+" ";
            else dys +="%^RESET%^"+(3)+" ";
         }
      }
      message("info",dys+"\n"
           "                  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\n",this_player());
      message("info",
      "                            Daily Highs for Past Month\n", this_player());
   }
   else if(arg == "n") {
      message("info","The following people were online yesterday.",this_player());
      nm=USAGE->query_names();
      write(format_page(nm, 5) +"\n");
   }
   else {
   message("info","\n"+USAGE->display_daily(), this_player());
   message("info",
   "                            Daily Census Chart\n", this_player());
   }
   a=USAGE->query_monthly();
   d=0;
   g=0;
   for(b=0,c=sizeof(a);b<c;b++) {
      if(a[b]==0) continue;
      if(a[b] > d) {
         d=a[b];
         g=b;
      }
      if(a[b] > 0) e++;
      f+=a[b];
   }
   b=USAGE->query_forever();
   write("            New Users Yesterday:     "+sizeof((USAGE->query_newbie())));
   write("            Unique Logins Yesterday: "+sizeof((USAGE->query_names())));
   write("            High in last 24 hours:   "+USAGE->query_maxday());
   write("            Daily Average:           "+(f/e)+"\n            High for Month:          "+d+" players, "+(USAGE->query_day()-g)+" days ago.");
   write("            Highest Recorded Usage:  "+b+"\n");
   return 1;
}

int help() {
message("help",
"This command is used to see mud usage over the last 24 hour "
"period.  You can use this to plan your play time depending "
"if you want to be on at the same time as the most or least "
"folks.  Usage: census\n<census m> will display a monthly chart."
"\n<census n> will display all folks who have logged in during past 24 hours.", this_player());
return 1;
}

Finally you will want to make two changes to /secure/lib/connect.c (WARNING, IF YOU BREAK CONNECT.C YOU WILL NOT BE ABLE TO LOGIN, SO BACK IT UP FIRST).

First in static private void eventEnterGame(), add the following line just before the call_out at the end of the function
Code: [Select]
    "/daemon/census_d"->login(Name);

Next in void eventCompleteChar() add the following line just before the call_out at the end of this function
Code: [Select]
    "/daemon/census_d"->newbie(Name);

All done.

14
Code Vault / Re: Quick summary of progs
« on: January 03, 2008, 06:22:41 am »
Apparently some folks were deleting their posts and this upset Crat so he removed edit till he can fix it, but doesnt know when the fix is coming.

15
Code Vault / Apropos command for DS
« on: January 01, 2008, 08:41:59 pm »
The following code adds apropos support for DS. Note that this is limited, and will only search through the help indexed files.
Syntax: apropos <name>

I.E.
apropos scan

returns:
[creator commands]:  scan
[Autodoc functions]:  doc_d/scan_mudlib

This will really help folks looking for information and searching for help since you do not need to know the full help name or page through all the docs.  Also, if you use the autodoc system I posted earlier frequently, it makes scanning it quicker too.

Add the following function anywhere in /daemon/help.c
Code: [Select]
mapping AllIndices(){
  mapping ret;
  ret = Indices;
  return ret;
}

Make the following command /secure/cmds/creators/apropos.c
Code: [Select]
/* Do not remove the headers from this file! see /USAGE for more info. */
// Modified from Lima 1.05b by Archaegeo on 1/1/08 for Dead Souls Lib

#include <lib.h>
#include <daemons.h>
#define MIN_LEN 3

mixed apropos(string s);

mixed cmd(string s) {
    string yt;
    if (!s)
    {
        write("apropos <string>\n\n"
          "Returns information on which mudlib functions contain the\n"
          "keyword passed, including a short description.\n");
        return;
    }
    if (strlen(s)<MIN_LEN)
    {
        write("Please find a bigger search criteria (min. "+MIN_LEN+
          " letters).\n");
        return;
    }
    yt=apropos(s);
    if (yt=="\n")
        write("No help files match your word.\n");
    this_player()->eventPrint(yt);
    return 1;
}

//:COMMAND
//Returns information on which help files contain the
//keyword passed, including a short description.

mixed apropos(string s)
{
    mapping filer=([]);
    mapping topics;
    string output="";
    string *st;
    string pwd;

    topics=HELP_D->AllIndices();
    if(!topics)
    {
        error("Apropos whines about help_d not giving any info out.\n");
        return;
    }
    foreach (string key,string *files in topics)
    {
        foreach(string d in topics[key]) {
            if (strsrch(d,s)!=-1)
            {   
                output += "[" + key + "]:  " + d +"\n";
            }
        }
    }
    output+="\n";
    return output;
}

string GetHelp(string str) {
    return ("Syntax: <apropos <name>>\n\n"
      "Pages through the help file names that have been indexed for <name>.\n"+
      "See also: help index");
}

Enjoy

Pages: [1] 2 3