Trying to Find a Code Snippet for COMPARE Command

  • Maximus
  • Maximus's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
5 years 8 months ago #1244 by Maximus
Does anyone know where I might be able to find a code snippet for something like a COMPARE command that will work in tbaMUD? By this I mean a command that allows players to quickly compare two or more pieces of gear with the same wear or wield location. Different MUD's I have played have handled this differently, but anything to get me started will work. I'm a pretty novice coder, so the more "plug and play" the better. I'm not averse to learning the nessacery coding to make this work, but I would rather not reinvent the wheel if there is already something out there I can use. Thank you in advance for your help!

Please Log in or Create an account to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #1245 by Rumble
It is blocked from my work, but there should be a few old snippets for CircleMUD here:
www.circlemud.org/pub/CircleMUD/submissions/snippets/

Rumble
The Builder Academy
tbamud.com 9091
Last edit: 5 years 8 months ago by Rumble.

Please Log in or Create an account to join the conversation.

  • Maximus
  • Maximus's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
5 years 8 months ago #1246 by Maximus
Thanks for the link, that's a start anyway. I am getting errors when I try to compile this however. Here is what I am seeing:
make ../bin/circle
make[1]: Entering directory `/home/goblinmu/tbamud-3.63/src'
gcc -g -O2 -Wall    -c -o act.informative.o act.informative.c
act.informative.c: In function 'do_compare':
act.informative.c:2683: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2683: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2688: warning: passing argument 3 of 'get_obj_in_list_vis' from incompatible pointer type
act.informative.c:2688: error: too few arguments to function 'get_obj_in_list_vis'
act.informative.c:2690: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2690: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2699: warning: comparison is always true due to limited range of data type
act.informative.c:2708: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2708: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2713: warning: passing argument 3 of 'get_obj_in_list_vis' from incompatible pointer type
act.informative.c:2713: error: too few arguments to function 'get_obj_in_list_vis'
act.informative.c:2715: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2715: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2676: warning: unused variable 'dotmode'
act.informative.c:2760:2: warning: no newline at end of file
make[1]: *** [act.informative.o] Error 1
make[1]: Leaving directory `/home/goblinmu/tbamud-3.63/src'
make: *** [all] Error 2

Any ideas?

Please Log in or Create an account to join the conversation.

More
5 years 8 months ago #1247 by Liko

Maximus wrote: Thanks for the link, that's a start anyway. I am getting errors when I try to compile this however. Here is what I am seeing:

make ../bin/circle
make[1]: Entering directory `/home/goblinmu/tbamud-3.63/src'
gcc -g -O2 -Wall    -c -o act.informative.o act.informative.c
act.informative.c: In function 'do_compare':
act.informative.c:2683: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2683: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2688: warning: passing argument 3 of 'get_obj_in_list_vis' from incompatible pointer type
act.informative.c:2688: error: too few arguments to function 'get_obj_in_list_vis'
act.informative.c:2690: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2690: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2699: warning: comparison is always true due to limited range of data type
act.informative.c:2708: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2708: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2713: warning: passing argument 3 of 'get_obj_in_list_vis' from incompatible pointer type
act.informative.c:2713: error: too few arguments to function 'get_obj_in_list_vis'
act.informative.c:2715: warning: passing argument 1 of 'send_to_char' from incompatible pointer type
act.informative.c:2715: warning: passing argument 2 of 'send_to_char' from incompatible pointer type
act.informative.c:2676: warning: unused variable 'dotmode'
act.informative.c:2760:2: warning: no newline at end of file
make[1]: *** [act.informative.o] Error 1
make[1]: Leaving directory `/home/goblinmu/tbamud-3.63/src'
make: *** [all] Error 2

Any ideas?


Can you copy and paste those lines for us?

DragonBall: Tournament (1.2.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #1248 by Rumble
On most old snippets you have to swap the arguments for send_to_char and mudlog.

So instead of:
send_to_char("text",ch);
you need:
send_to_char(ch, "text");

Look at the other errors and compare them to how they are used somewhere else in the code and adjust as well. That should fix the majority of your errors. Learn to use grep/find and compare proper usage.

Rumble
The Builder Academy
tbamud.com 9091
Last edit: 5 years 8 months ago by Rumble.

Please Log in or Create an account to join the conversation.

More
3 weeks 6 days ago #8198 by Parnassus
I found that out of the three compare snippets, this one worked, I think without changes:
www.circlemud.org/pub/CircleMUD/submissi...ands/compare-new.txt

Even the send_to_char parts have already been changed.

However, it's missing these parts:
This one is mentioned but not explained:
interpreter.c around line 124
-  { "compact"  , "comp"    , POS_DEAD    , do_gen_tog  , 0, SCMD_COMPACT },
+  { "compare"  , "comp"    , POS_RESTING , do_compare , 0, 0 },
+  { "compact"  , "compa"   , POS_DEAD    , do_gen_tog  , 0, SCMD_COMPACT },

This one is not mentioned that I can see:
act.h (act.informative.c section) around line 88
 ACMD(do_areas);
+ACMD(do_compare);
 ACMD(do_consider);

The line numbers are not guaranteed, of course, and are subject to change.

Please Log in or Create an account to join the conversation.

Time to create page: 2.620 seconds