Listing by Keyword

Started by Twilight, April 25, 2005, 02:20:04 PM

Now that merchants can have oodles and oodles of things to sell you, I think it would be nice if we could get a list of goods per a modifer.  Something like:

list sword

The green-skinned half-giant merchant has the following goods to trade:
05)  a big, bone sword for 10 obsidian coins
08)  a fully badass obsidian sword for 50 obsidian coins
13)  a small spiked halfsword for 25 obsidian coins
47)  a steel shortsword for a bazillion obsidian coins and your firstborn son

A lot easier to digest if you are just looking for a sword than all the items on the list.  A lot easier not to miss that steel shortsword you might otherwise have just scrolled past.  The numbers are still there in their proper order on the overall list, so you can still buy/sell/offer based on the number in the truncated list.

Now, this might get confused with the syntax of "list merchantname" so perhaps something needs to be done there.  So it might need to be "list (sword)" so you can "list (sword) secondmerchantname" or somesuch.
Evolution ends when stupidity is no longer fatal."

Yeah, it's possible. Not hard to code, but it'd take a bit because you'd have to define each keyword for each item type.

In other words, a short look at it would be.

void do_list(args here)
{
  /* code
   code
   more code

   Then you get to*/

   if (!str_cmp( arg, "swords") || !str_cmp( arg, "sword" ) )
   {

       /* for statement for item types of that kind, leave out everything        
          else. */

       return;

   }

}



As for the thing about the syntax, it'd just have to be before 'merchantname'

It'd take a little changing. Once again, not too difficult.
For FantasyWriter:
Never again will I be a fool, I will from now on, wrap my tool.

I'm not sure, I think you misunderstood.  The list would be by item keyword, not item type.  List sword would give you all items with a keyword of sword.  List bone would give you all items with a keyword of bone.
Evolution ends when stupidity is no longer fatal."

Yes, this is very easy to do, and I hope someone does it.

Thanks,
Cindrak

EDIT: Not like cyberpatrol's code snippet. There's no need to do a bunch of special cases for each item type, just see if the keyword provided is a keyword of the object. Also, I might add, this is a perfect place to use the keys_to() function I provided here:

http://www.zalanthas.org/phpBB2/viewtopic.php?t=13051

Using that function, you'd just do:

merchant_list(char, keyw, merchant)
{
   foreach (obj in merchant's list)
       if ( keys_to(keyw, obj->keyword_list) )
           list_object_to_char(obj, char);
}


Then you could provide not just one keyword, but as many as you like, to narrow it down to just bone swords, for instance:

>list bone.sword
quote="www.baobobcomic.com"]Naturally, the worst happened. Soon we saw not only a PC, but one of those weird PCs who uses words I don't know in their sdesc. The podgy, dappled dickens-whelp.[/quote]

I think it isn't quite as easy as people are making out, but I agree it would be pretty good :)

Quote from: "John"I think it isn't quite as easy as people are making out, but I agree it would be pretty good :)

Even one of the simplest coder's could do this I'm afraid. This is grade 1 using a for statement.

And you're right, you wouldn't have to do the special cases if you're looking for a keyword, that would just be for a 'type' of item, keywords would in fact be easier.

Key_to looks like a good thing right here, I've never experimented with it too much.
For FantasyWriter:
Never again will I be a fool, I will from now on, wrap my tool.

Quote from: "John"I think it isn't quite as easy as people are making out...
Any particular reason you think this? I've basically given all the code necessary to do this (except the list_object_to_char function, but that code is obviously already in the game in some form.)

-Cindrak
quote="www.baobobcomic.com"]Naturally, the worst happened. Soon we saw not only a PC, but one of those weird PCs who uses words I don't know in their sdesc. The podgy, dappled dickens-whelp.[/quote]

QuoteYes, this is very easy to do, and I hope someone does it.

Thanks,
Cindrak

You might want to try just emailing this stuff directly to the staff. They might not see it here.
The intelligent man finds almost everything ridiculous, the sensible man hardly anything."
--Johann Wolfgang von Goethe

There is a lot more context in the code than these examples take into account.  For example, both of these code snippits assume that the new argument just appears out of thin air, which of course it doesn't.  There are other complications as well, but on principle I just want to post to say that no, making major changes to a command does not involve writing 4 lines of code.  I feel a little frusterated when people imply that what we do is this simple.

Quote from: "Raesanos"I feel a little frusterated when people imply that what we do is this simple.

I feel your pain.  At work we have a very complex medical billing system, with millions of records.  The CEO  could not understand why a complex production by insurance report would take so long to write, I mean all we had to do was "just sort some records".  In class one time a long time a go this was called the "naive" approach.   Simple things are not always simple.
quote="Morgenes"]
Quote from: "The Philosopher Jagger"You can't always get what you want.
[/quote]

What I wrote above was partly pseudocode, obviously. I wasn't trying to imply that it would only take four lines, I was just giving an outline.

-Cindrak
quote="www.baobobcomic.com"]Naturally, the worst happened. Soon we saw not only a PC, but one of those weird PCs who uses words I don't know in their sdesc. The podgy, dappled dickens-whelp.[/quote]

Quote from: "Cindrak"Any particular reason you think this?
What Raesanos said, but also just in general principle. From what very little coding I've done, I know how complicated stuff can get. You start with something that does something VERY basic. Then you add in a minor update that adds a little functionality, then add in another update that adds a little functionality. You go add in another update for another function, but it has a side-effect with a previous update, so you work around it and then implement it. And then next time another side-effect occurs, so you work around it, etc, etc.

Maybe I'm just a bad/lazy programmer, because in theory that isn't suppose to happen, and I'm sure the imms do their best to minimize it. But I personally think it's an inevitable part of coding. And I imagine the shopping code has had quite a few updates over the years (one update since I've played is to group items together).

Quote from: "John"From what very little coding I've done, I know how complicated stuff can get.
...
Maybe I'm just a bad/lazy programmer, because in theory that isn't suppose to happen...

Myeah.

So. Anyway. Where was I? Oh yeah...

This is not rocket science. It's not a complex medical system with millions of records needing to be sorted. It's Diku programming, and furthermore it's a feature that's been implemented on countless muds the world over. There will be subtleties and caveats in the actual implementation, to be sure, but it's just really not that hard to do. Unless Arm has gone and spaghettified the shop listing code beyond all recognition, I stand by this statement.

Thanks,
Cindrak
quote="www.baobobcomic.com"]Naturally, the worst happened. Soon we saw not only a PC, but one of those weird PCs who uses words I don't know in their sdesc. The podgy, dappled dickens-whelp.[/quote]

Cindrak, let it go.
You're not making any friends nor pushing any difference forward.

All you're doing is annoy the coders.

Armageddon is a customized MUD that's been up for a decade and a half.  It's probably not standard DIKU+snippets.

Let it go.  We know you're trying and wanting to help, and we all appreciate it.
Quote from: Vesperas...You have to ask yourself... do you love your PC more than you love its contribution to the game?

From my vast experience coding for another diku RPI mud (a whole month) I think it is pretty misguided to assume things are as trivial as you put forth.  I set a few minor code change goals and started working on them and the functions I wrote worked fine, except for that I had to then go change the logging functions, then subsequently I had to make changes to the DB structure and all of the sudden what was a very, very simple change became a big deal.  I can only imagine that after 10+ years and dozens of hands in the pot it's hardly anything like standard diku to begin with.

Impossible?  Of course not, but not some 5 minute change anyone fresh out of a 'Learn C in 24 hours' book can do.

Quote from: "Cindrak"
Quote from: "John"From what very little coding I've done, I know how complicated stuff can get.
...
Maybe I'm just a bad/lazy programmer, because in theory that isn't suppose to happen...

Myeah.

So. Anyway. Where was I? Oh yeah...

This is not rocket science. It's not a complex medical system with millions of records needing to be sorted. It's Diku programming, and furthermore it's a feature that's been implemented on countless muds the world over. There will be subtleties and caveats in the actual implementation, to be sure, but it's just really not that hard to do. Unless Arm has gone and spaghettified the shop listing code beyond all recognition, I stand by this statement.

Thanks,
Cindrak

Honestly there are so few merchants that carry a ton of merchandise that I really don't see this as a necessity. Towards the end of the week some of the shops get over crowded with items PC's bring in. But.. I hardly think it's something to start tinkering with the code over. Also our coders are very busy, and to boot this is a hobby for them.

So, I believe Rae, who does a good portion of our coding spoke on this. Also, you really don't know what the code looks like until you open it up and see.

And if you want to debate someone that's fine, but please don't belittle other people's opinions. It's flaming.
Sometimes I feel less like an immortal and more like a drug dealer.

Quote from: "CRW"From my vast experience coding for another diku RPI mud (a whole month)
I've been a coder for a heavily modified, 13 year old Diku, for about four years. Take that for what it's worth.

QuoteImpossible?  Of course not, but not some 5 minute change anyone fresh out of a 'Learn C in 24 hours' book can do.
I'm assuming our coders are not novices. And I didn't say "5 minutes." It might take an hour, for a competent coder.

I never intended to trivialize what the coders do. An hour or two is a not-insignificant lump of time, and maybe they'd rather spend it doing something else. Even if a project is a good idea and wouldn't take that long, it might not be that sexy project that they're really interested in doing. So I totally understand where Raesanos is coming from. And I'll stop haranguing now.

Have a nice day,

-Cindrak
quote="www.baobobcomic.com"]Naturally, the worst happened. Soon we saw not only a PC, but one of those weird PCs who uses words I don't know in their sdesc. The podgy, dappled dickens-whelp.[/quote]

Yeah, it's probably pretty easy.  Thanks for the suggestion.  In the future, it's worth noting that time/difficulty estimates and code/pseudocode samples _aren't_ required for idea submissions, and aren't likely to ingratiate you to your audience, as they imply ineptitude on our part (especially if your initial assertion is that the problem is an easy one).

Also, while we try to keep up with as many ideas like this as we can, we have a full database of bugs, typos, ideas, etc., of which a significant portion are either greater "bang for the buck", or are more likely to improve our stability or overall playability than some of the ideas presented here.  Furthermore (as I've mentioned in previous posts) the staff are encouraged to enhance the game by tackling tasks that they find enjoyable, and aren't specifically forced to focus on tasks that are popular.

Lastly, as a community, it would be better for everyone who is active on these boards if discussions about how easy or difficult a particular feature is to implement, held forth by people who have never seen the Armageddon code base (significantly different from any Diku code some people seem comfortable comparing us with -- the only major chunks that are still core Diku are very, very low-level and simply haven't needed enhancement yet), if such discussions could be carried out via private messages.

Perhaps these "I'm a better coder than thou" contests would be topical on IRC.  :)

Thanks,
 X

Turns out, this was about 10 lines of code, all told.  Should be in after tomorrow's downtime (unless we crash tonight).

-- X

Wow.

Since it is now implemented, I just wanted to say that I am firmly in favor of the idea.  ;)


Seeker
Sitting in your comfort,
You don't believe I'm real,
But you cannot buy protection
from the way that I feel.

Yeah, me too. :D Thanks, Xygax.
quote="www.baobobcomic.com"]Naturally, the worst happened. Soon we saw not only a PC, but one of those weird PCs who uses words I don't know in their sdesc. The podgy, dappled dickens-whelp.[/quote]

Xygax expressed the matter far better than I did, especially since the line length discussion ended up not being a good indication of what our concern is.

Thank you a ton Xygax, no I can buy all those pirty lil slippers.

What are the commands though?
Quote from: Shoka Windrunner on April 16, 2008, 10:34:00 AM
Arm is evil.  And I love it.  It's like the softest, cuddliest, happy smelling teddy bear in the world, except it is stuffed with meth needles that inject you everytime

Yes, Armageddon's code is a half-wild compilation of years of numerous people editing it, each person with varying degrees of skill or coding philosophy.  On the one hand it lets us implement more and helps more people contribute ideas & code, while on the other it can create areas of inefficiency and subtle bugs amidst sometimes difficult to navigate lines of code (sometimes by way of style, sometimes by simple inconsistency from one section to another).  That said, we've also got some top coderz, and Xygax in particular came on as a champ with a lot of talented effort in smoothing those bumps.

I can't think of a time anyone looked around and said "dude, that's impossible," as despite the extensive editing in Armageddon's code over the years it remains understandable & manipulable -- just occasionally takes a little patience.  I've only heard "dude, we can do that, but it means rewriting this, that, the other, and adding tiddledee too"...meaning, some things, as would be expected, aren't practical to implement.

-Savak
i]May the fleas of a thousand kanks nestle in your armpit.  -DustMight[/i]

The new syntax is now described in "help list".

-- X