Hello again. I'm finding all sorts of hidden gems that I need help with. So, here is my problem. The code below works fine except for one thing. The syntax is "influence material <material>" to get a quantity of material in which to build or make something with. And it works. But the problem is, if they ask for something that is not in the table, it generates "x pounds of none." How can I make it so that if what they request is not in the table, it does not generate anything but gives them some message?
int scientific_materials(CHAR_DATA *ch, char *argument) { int fail = UMIN(dice_rolls(ch, get_curr_stat(ch, STAT_CHA) + ch->ability[SCIENCE].value, 7), ch->influences[INFL_SCIENTIFIC]); char arg[MAX_INPUT_LENGTH]; int material, size; OBJ_DATA *obj;
if((material = material_lookup(arg)) < 0) { send_to_char("There is no such material.\n\r", ch); return FALSE; }
This should be where the problem of a errant material name is eliminated. Either there is a bug in your material_lookup() or more likely, this should be set to <= 0 instead.
It was fine when I was suggesting all these fine ideas to the ex-coder, but now that I am the coder, it's much more difficult. C'est la vie and all that.
It was fine when I was suggesting all these fine ideas to the ex-coder, but now that I am the coder, it's much more difficult. C'est la vie and all that.
Yes, I know that. It seems I'm finding bugs in stuff that got reported but never fixed, so I'm fixing them before implementing anything new.
18 Oct, 2011, David Haley wrote in the 10th comment:
Votes: 0
Well, at least it's commendable to be doing housekeeping rather than letting issues pile up as you add new stuff. And this is a good learning experience, too…
What's the point in adding new stuff if the "new" stuff I have is broken or doesn't work quite right is my thinking. And yes, this is definitely learning, which is why I am asking questions on why, not just fix this.
19 Oct, 2011, David Haley wrote in the 12th comment:
Votes: 0
Trust me, you'd be surprised how often new features are introduced rather than bugs fixed. :wink:
Not really. I've been involved in software development or software rollouts and it just amazes me sometimes. I'd rather have what I have work than it not work and keep building on bad. Again, I'm not a great coder, but I want to fix what needs fixing, even if it means coming for help.