Heya... > Ok I know I'm gonna get flamed for this but I need to know how to write > arguments more than say 7 characters long?? No - the dumbest question is the one unasked ;) > > Heres what I'm trying to do: > Add a simple race system so you start off human and can buy the cyborg > class and what not :) Well, string comparison does not work that way in C. It is done with the strcmp function, or the str_cmp that is in utils. So, if you'd really wanted to compare strings, it should be like: if (!strcmp(argument, "cyborg")) { do_code1(); } else if (!strcmp(argument, "robot")) { do_code2(); } else { do_default(); } Maybe you should considering working with flags though! This will work roughly like this, defining a long integer, and you can set/unset/mask its bits. Have a closer look at the PRF and PLR flags, and how the macros IS_SET, SET_BIT, REMOVE_BIT are defined. For a race you could also use a single value, and you define it's meaning like #define RACE_HUMAN 1, #define RACE_CYBORG 2 etc. Now, when to use flags when to use single values? If you want, that one aspect can have several states, like being human and cyborg at the same time, use flags. Otherwise, if that value is absolute, like: you can either be human (x)or cyborg (x)or robot...than use a single value. > > switch (*argument) { > case 'cyborg': > <code> > break; > case 'robot': > <code> > break; > default: > send_to_char("Your not a human!!", ch); > break; > } > > Thanx, > Demond > > Ps sorry for bugging you all. Hope to have helped out, - Chris > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Name: Demond LaZaro the Implementor Phone: 1-505-776-8866 > Mud: Master's Realm Mud Code Base: CircleMud bpl11 > Addy: realms.org 6969 Addy2: 206.185.32.8 6969 > Mud2: Towers from Beyond 2 Code Base: CircleMud bpl12 > Addy: realms.org 6050 Addy2: 206.185.32.8 6050 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > +------------------------------------------------------------+ > | Ensure that you have read the CircleMUD Mailing List FAQ: | > | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | > +------------------------------------------------------------+ > -- /----------------------------------------------------------------------------\ | Christian Loth | Meet me as the >Shadowdancer< in the | | Shadowdancer@unidui.uni-duisburg.de | REALM OF MAGIC | | http://privat.schlund.de/Loth | telnet rom.mud.de 4000 | | | http://rom.mud.de/ | | "The road goes ever on and on!" - Bilbo Baggins | \----------------------------------------------------------------------------/ +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST