> In patch level 14 I was tring to add a class display in the function
> do_score in act.informative.c The below is what I tried to use:
> sprintf(buf, "Class: %d", GET_CLASS(ch));
> if (GET_REMORT(ch) >= 0) {
> sprintf(buf, " Dual: %d", GET_REMORT(ch));
> }
> Now I have no compiling problems, but when you type score now it displays
> a number instead of a class name. I have this same problem when I call
> GET_NAME(ch) in a mudlog command, it just displays a number. Can anyone
> tell me what is actually be displayed and how I could get it to show the
> proper text? Thanx.
This is one case where a C book would come in REALLY handy...
%d is used to represent a double precision integer -- a number, which is
exactly what the GET_CLASS macro returns. If you want to display the name
of the class you have to refer to the pc_class_types[] array, using the
GET_CLASS macro as the array element. Something like
sprintf(buf, "Class: %s", pc_class_types[GET_CLASS(ch)]);
will work, but may give you a warning about the array having a char
subscript. Luckily there is a function included with circle --
sprinttype() which allows you to print out char array elements, used in
the following:
sprinttype(GET_CLASS(ch), pc_class_types, buf);
send_to_char(buf, ch);
This is the quick 'n easy, warning free method. Hope this helps.
"Misery is boundless"
-Xual the Torturer, on the Eve of the Sundering.
Danathara Online RPG
telnet://satanspawn.ml.org: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/15/00 PST