Author Topic: player wipe code , problem  (Read 4417 times)

Offline vexcesban

  • Acquaintance
  • *
  • Posts: 25
  • -Noobie Mud Admin-
    • View Profile
player wipe code , problem
« on: December 01, 2008, 06:45:19 pm »
Hey guys, I have been browsing these forums on and off for quite some time and am glad to see it's still going. I'm running a heaven7 mudlib that has been ripped apart and completely redone. I am trying to make a script to edit player files and am having some trouble. I have a stock file to convert them , but its from 93' and im having trouble updating it. Here's what i have. My problem is the 'convert_directory' function, it gives me an Auto-Rehash failure and i have no idea how 'char' makes 'a' + 1 = 'b'. Obviously i'm not an expert programmer, and i'm not looking for someone to write me the solution, just to point me in the right direction. Thanks in advance for any help or tips :)


#include <mudlib.h>
#define TIME_BETWEEN_DIRS    10

string name;
string alias_name;
string alt_name;
int short_desc;
string long_desc;
int extra_info;
mapping environment_variables;
mapping perm_attrib;
int rank;
int spouse;
string house;
int title;
string pretitle;
string who_string;
int color;
string race;
int alignment;
int class;
int avatar;
string profession;
int magic;
int faith;
int last;
mapping stats;
mapping extra_stats;
mapping maxstats;
mapping skills;
int mdmg;
int sdmg;
int bheal;
int pabs;
int mabs;
int augenc;
int aughp;
int augego;
int augac;
int manashieldx;
int bashx;
int purgex;
int berzerkx;
int hinderx;
int entanglex;
int rregenx;
int syphonx;
int cost;
mapping varibles;     
int level;
int whimpy;
int experience;
int money;
int age;
int gender;
int is_invis;
int lifetime_wps;
int urwp;
int last_pked;
mixed *inventory;
mixed *backup_inv;
mapping aliases;
mapping RegistrationInfo;
mapping channels;
int hp;
int sp;
int mp;
int max_hp;
int max_sp;
int max_mp;
int cc;
int prompt;
string prompt_str;
int rregen_cd;
int syphon_cd;
int bash_cd;
int berzerk_cd;
int purge_cd;
int ropetrick_cd;
int scepter_cd;
int selfbonustime;
int selfbonusrate;
int security_level;
int create;
int last_update;
int last_on;
int last_save;
int last_off;
int last_death;
int last_combat;
int last_pk;
int wp;
int member;
int crash_flag;
int quest_points;
int savings;
int total_exp;
int master_exp;
int intoxicated;
int stuffed;
int soaked;
int scar;
int deaths;
int party;
string email;
int address;
mixed *quests;
string ip_number;
string called_from_ip;
string enter_room;
string password;
int TESTT;

  call_out("convert_directory", TIME_BETWEEN_DIRS, 'a');

  if (this_player())
  write("Convert finished.\n");

  string *files;
  int index, size;
  files = get_dir(sprintf("/usr/mortal/%c/*.o", char));
  size = sizeof(files);
  for(index = 0; index < size; index++)
   convert_character(sprintf("/usr/mortal/%c/%s", char, files[index][0..<3]));
  if (char == 'z') end_convert();
  else call_out("convert_directory", TIME_BETWEEN_DIRS, char+1);



perm_attrib = (["EQrestore":(["weapon":([]),"armor":({}),]),]);
rank= 0;
house= "commoner";
title= 0;
race= "";
profession= "";
stats= (["strength":10,"dexterity":10,"agility":10,"stamina":10,"intellect":10,"wisdom":10,"primal":10,"focus":10,]);
extra_stats= ([]);
maxstats= (["strength":200,"dexterity":200,"agility":200,"stamina":200,"intellect":200,"wisdom":200,"primal":200,"focus":200,]);
skills= ([]);
mdmg= 0;
sdmg= 0;
bheal= 0;
pabs= 0;
mabs= 0;
augenc= 0;
aughp= 0;
augego= 0;
augac= 0;
manashieldx= 0;
bashx= 0;
purgex= 0;
berzerkx= 0;
hinderx= 0;
entanglex= 0;
rregenx= 0;
syphonx= 0;
cost= 0;
varibles= (["selfbonus_time":8997,"selfbonus":50,]);
level= 1;
whimpy= 0;
experience= 0;
money= 0;
is_invis= 0;
lifetime_wps= 0;
urwp= 0;
last_pked= 0;
inventory= ({});
backup_inv= ({});
channels+= (["world":1,]);
cc= 0;
rregen_cd= 0;
syphon_cd= 0;
bash_cd= 0;
berzerk_cd= 0;
purge_cd= 0;
ropetrick_cd= 0;
scepter_cd= 0;
last_on= 1228175234;
last_save= 0;
last_off= 1228175242;
last_death= 0;
last_combat= 0;
last_pk= 0;
wp= 1;
member= 0;
crash_flag= 0;
quest_points= 0;
savings= 0;
total_exp= 0;
master_exp= 0;
stuffed= 0;
soaked= 0;
scar= 0;
deaths= 0;
party= 0;
quests= ({});
enter_room= "d/camp/15";


Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1024
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: player wipe code , problem
« Reply #1 on: December 01, 2008, 07:05:18 pm »
Wow...this code is kind of hard to follow. Maybe it's because
I'm not used to LD code...but I think the flow is kinda weird,
too. Anyway, what you're probably missing is that


is a character, not a string, and as such it actually
represents an ascii value, in this case the integer 97.

Therefore 'a' + 1 is 98. Which, as it happens, is the
ascii value for the letter b.

I'm guessing you want more help in the sense of "how do I
get this to work", but while we wait for an LD expert to
help, at least I can provide the answer to the question
you asked.


Offline chaos

  • BFF
  • ***
  • Posts: 291
  • Job, school, social life, sleep. Pick 2.5.
    • View Profile
    • Lost Souls
Re: player wipe code , problem
« Reply #2 on: December 02, 2008, 01:55:32 am »
There's nothing obviously wrong with it.  'Auto-Rehash Failure' means nothing to me.  A paste of exactly what goes wrong would be nice.

Offline Tricky

  • BFF
  • ***
  • Posts: 189
  • I like what I code and I code what I like!
    • View Profile
Re: player wipe code , problem
« Reply #3 on: December 02, 2008, 07:14:29 am »
Can't see anything myself except for the old-style 2.4.5 calling conventions and the functions haven't been prototyped.

Code: [Select]
void convert();
void end_convert();
void convert_directory(int char);
void convert_character(string file);
void convert_data();