Welcome to the Builder Academy

Loved New OLC Craft System

More
26 Jun 2012 02:49 #253 by Halenbane
Replied by Halenbane on topic Re: New OLC Craft System
May also be linked somehow to this other error I'm getting

crafts.c:900: warning: operation on 'vnum' may be undefined

Code:
write_to_output(d, "\t1-- Craftedit Menu\t1 : \t2[\t3%d\t2]\tn\r\n" "\t20\t3) Craft Name : \t1%s\tn\r\n" "\t21\t3) Craft Timer : \t1%d seconds\tn\r\n" "\t22\t3) Craft Item : \t1\"\tn%s\t1\"\tn\r\n" "\t23\t3) Rare Craft : \t1\"\tn%s\t1\"\tn\r\n" "\t24\t3) Success Self : \t1\"\tn%s\t1\"\tn\r\n" "\t25\t3) Success Room : \t1\"\tn%s\t1\"\tn\r\n" "\t26\t3) CritSucc Self : \t1\"\tn%s\t1\"\tn\r\n" "\t27\t3) CritSucc Room : \t1\"\tn%s\t1\"\tn\r\n" "\t28\t3) Failure Self : \t1\"\tn%s\t1\"\tn\r\n" "\t29\t3) Failure Room : \t1\"\tn%s\t1\"\tn\r\n", CRAFT_ID(c), CRAFT_NAME(c), CRAFT_TIMER(c), ((vnum = real_object(CRAFT_OBJVNUM(c))) != NOTHING) ? obj_proto[vnum].short_description : "None", ((vnum = real_object(CRAFT_CRIT_OBJVNUM(c))) != NOTHING) ? obj_proto[vnum].short_description : "None", CRAFT_MSG_SELF(c), CRAFT_MSG_ROOM(c), CRAFT_CRIT_MSG_SELF(c), CRAFT_CRIT_MSG_ROOM(c), CRAFT_FAIL_MSG_SELF(c), CRAFT_FAIL_MSG_ROOM(c));

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

More
26 Jun 2012 02:54 #254 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System
You can use rnum as many times as you like, however since you are initializing it twice, the first time is pointless. Thus, "These prints detail.... " will always identify the short description of your CRIT_OBJVNUM. You could always create another rnum, ie:
Code:
obj_rnum rnum, rnum2, rnum3, newrnum, myrnum;
or you could simple move the second "rnum = ..." down to right above where you identify the "rare chance" item.

And the reason it is constantly saying nothing appears to be because there is no item with the vnum you have entered into real_object().

tbaMUD developer/programmer

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

More
26 Jun 2012 02:56 #255 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System
FYI, helping to debug your code would be easier if you'd identify which line is the line in question.

tbaMUD developer/programmer

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

More
26 Jun 2012 03:50 #256 by Halenbane
Replied by Halenbane on topic Re: New OLC Craft System
I basically want it to read a random number between 1 - 10 which is defined as crit
If crit > rand, then spawn crit item, else spawn regular item unless rand > skill. Basically giving a 10% chance to crit.

I had it setup previously for crit to be 90-100 but because of the way it is written it seemed easier to make crit a lower number vs rand since its skill > rand for success.

crafts.c: In function 'event_craft':
crafts.c:549: warning: implicit declaration of function 'real_obj'
crafts.c:549: warning: implicit declaration of function 'CRAFT_CRIT_VNUM'
crafts.c:576: error: expected expression before 'else'
crafts.c:651: error: invalid storage class for function 'copy_requirement'
crafts.c:656: error: invalid storage class for function 'copy_craft'
crafts.c:707: error: invalid storage class for function 'craftedit_setup_new'
crafts.c:806: error: invalid storage class for function 'craftedit_disp_skill_menu'
crafts.c:823: error: invalid storage class for function 'craftedit_disp_req_flags'
crafts.c:841: error: invalid storage class for function 'craftedit_disp_craft_flags'
crafts.c:859: error: invalid storage class for function 'craftedit_requirement_menu'
crafts.c:881: error: invalid storage class for function 'craftedit_disp_menu'
crafts.c:1244: error: expected declaration or statement at end of input


Code:
skill = GET_SKILL(ch, CRAFT_SKILL(craft)) - (CRAFT_SKILL_LEVEL(craft) / 2); rand = rand_number(1, 100); crit = rand_number(1, 10); if (rand < crit) { if (real_obj(CRAFT_CRIT_VNUM(craft)) != NOTHING && rand > crit) { <--- LINE 549 remove_components(ch, craft, TRUE); obj_to_char(obj, ch); act(CRAFT_CRIT_MSG_SELF(craft), TRUE, ch, obj, 0, TO_CHAR); act(CRAFT_CRIT_MSG_ROOM(craft), TRUE, ch, obj, 0, TO_NOTVICT); } else { if (skill > rand) { if ((obj = read_object(CRAFT_OBJVNUM(craft), VIRTUAL)) == NULL) { send_to_char(ch, "You seem to have an issue with your crafting.\r\n"); mudlog(CMP, LVL_GOD, TRUE, "SYSERR: Event Craft called without created object."); return (0); } } remove_components(ch, craft, TRUE); obj_to_char(obj, ch); if (!CRAFT_MSG_SELF(craft)) send_to_char(ch, "You have created %s.\r\n", obj->short_description); else act(CRAFT_MSG_SELF(craft), TRUE, ch, obj, 0, TO_CHAR);

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

More
26 Jun 2012 04:05 #257 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System
1) real_object, not real_obj
2) check your crafts.h for your definition of CRAFT_CRIT_VNUM
3) Line 549 needs a closed bracket

tbaMUD developer/programmer

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

More
26 Jun 2012 04:27 #258 by Halenbane
Replied by Halenbane on topic Re: New OLC Craft System
When you say it needs a close bracket, you mean in place of the opening bracket? Kinda confused, thought I had the brackets in properly... When I change it to a closing bracket..

crafts.c: At top level:
crafts.c:556: error: expected identifier or '(' before '}' token
crafts.c:556: error: expected identifier or '(' before 'else'
crafts.c:576: error: expected identifier or '(' before 'else'
crafts.c:580: error: expected identifier or '(' before 'else'
crafts.c:587: error: expected identifier or '(' before 'return'
crafts.c:588: error: expected identifier or '(' before '}' token

I know it's something simple I'm overlooking..

Thanks again for your help.
Code:
if (real_object(CRAFT_CRIT_OBJVNUM(craft)) != NOTHING && rand > crit) } remove_components(ch, craft, TRUE); obj_to_char(obj, ch); act(CRAFT_CRIT_MSG_SELF(craft), TRUE, ch, obj, 0, TO_CHAR); act(CRAFT_CRIT_MSG_ROOM(craft), TRUE, ch, obj, 0, TO_NOTVICT); } } else { if (skill > rand) { if ((obj = read_object(CRAFT_OBJVNUM(craft), VIRTUAL)) == NULL) { send_to_char(ch, "You seem to have an issue with your crafting.\r\n"); mudlog(CMP, LVL_GOD, TRUE, "SYSERR: Event Craft called without created object."); return (0); } } remove_components(ch, craft, TRUE); obj_to_char(obj, ch); if (!CRAFT_MSG_SELF(craft)) send_to_char(ch, "You have created %s.\r\n", obj->short_description); else

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

Time to create page: 0.217 seconds