> From: Neuromancer <amarquez@TRINITY.EDU> > To: CIRCLE@post.queensu.ca > Subject: [Code] Changing parse_class to integers ... > Date: Saturday, September 27, 1997 1:07 AM > > This problem has been driving me nuts for a few hours now and > i think i definately need help. > I want to get parse_class to accept integers instead of characters > (so the menu is 1 - thief, 2 -cleric, etc) but I can't seem to figure > out how. I tried: > > > int parse_class(char arg) > { > int temp; > temp = atoi(arg); > switch (temp) { case '1': /* stuff */ break; case '2': You get the idea. You still use characters, just characters that LOOK like numbers. If you want 20 classes, then you would have something like: 1) Class 1 2) Class 2 ... A) Class 10 /*Kinda like hex eh? */ ... Z) Class 36 a) Class 37 /* Make it case sensitive..., though most users wouldn't like it */ z) Class something big. You won't have this many classes I think. I am using numbers, and this is how I did it. --- A disadvantage to using numbers that I have encountered over time..., when using "set player class X", you need to know what that class (or race if you use them) uses in parse_class. ------------------------------------------------------ Rob Baumstark: shirak@connect.ab.ca cst0656@nait.ab.ca Forsaken Realms: telnet://drewl.v-wave.com:4000 ------------------------------------------------------ +------------------------------------------------------------+ | 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