Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ Item Database

Item Database

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ishnaf   Australia  (17 posts)  Bio
Date Mon 14 Apr 2003 01:45 PM (UTC)
Message
Gday - I just downloaded the MudDatabase plugin - its brilliant :)

I've fiddled with some bits and pieces and managed to connect to my database and make it automatically update itself when i find out about new EQ, the only problem is that when i call up the information I get:

Item ItemType ItemIs ForgeLevel DiceNo DiceSize Weight Value Rent ACApply Armor CON INTEL WIS DEX CHA STR Hitroll Damroll maxhit maxmana Uselevel Age
Cloak of the Innocents ARMOR GLOW !GOOD !NEUTRAL NOBITS0 0 0 5 200000 480 0 0 0 0 0 0 0 1 0 3 0 0 0 0

which is hard to read :P

Could someone please help me with making a snippet of code to display this that:
1.Doesnt display Null values (e.g. 0 or just a blank field)
2.Displays it like:
Item:A cloak of the innocents ItemType:ARMOR ItemIs:GLOW etc

Dont worry about showing every field, just showing a few to get me started would be great :) And nobody comment on my database structure - it started off neat but i kept adding new fields :P

Thankye,
Ishnaf



egads!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 15 Apr 2003 05:11 AM (UTC)
Message
This code from that plugin shows the general idea:


  Do Until rst.EOF

    count = count + 1

    mud_name     = rst.Fields ("mud_name").Value
    ip_address   = rst.Fields ("ip_address").Value
    port         = rst.Fields ("port").Value
    description  = rst.Fields ("description").Value

    world.ColourTell "white", "darkred", mud_name
    world.ColourTell "white", "black", " IP: " & ip_address
    world.ColourTell "white", "black", " Port: " & port
    world.Note ""

    world.ColourNote "silver", "black", description

    world.Note ""

    rst.MoveNext
  
  Loop


Here I am pulling out individual fields (eg. rst.Fields ("port").Value) and then using them in individual ColourTell lines.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Xyborg   Canada  (47 posts)  Bio
Date Reply #2 on Sat 30 Aug 2003 10:04 PM (UTC)
Message
Hmmm. I went to the list of plugins and I can't find this one. It'd be great to use on the MUDs I play as there's a chest system like Diablo 2 and I walk around with anywhere between 20 and 50 new items due to the random item generation code.

If you know where it is, lemme know.

We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 30 Aug 2003 11:22 PM (UTC)
Message
See:

http://www.gammon.com.au/mushclient/plugins/

Half-way down the page is the plugin "MudDatabase".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Xyborg   Canada  (47 posts)  Bio
Date Reply #4 on Sat 30 Aug 2003 11:24 PM (UTC)
Message
ah. Thanks Nick. Oh yeah, i made a topic called Numeric/Calculator or something. Wanna check it out for me?

We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept.
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #5 on Sun 31 Aug 2003 12:46 AM (UTC)
Message
Umm. Think you missed the point there Nick.

The trick here is to pad values using the length of the result. For instance, say you have the following:


Item   AC  Value       Description
Cloak   5    500 gold  A fur cloak.

So if you do this:

Item_Name = rst.Fields ("item_name").Value
Item_AC = rst.Fields ("item_ac").Value
Item_Value = rst.Fields ("value").Value
Item_Description = rst.Fields ("descrip").Value

You would then do this to get it to look like above:

MaxColumns = 80
pad = space(5 - len(Item_Name))
tell Item_Name & pad & " "
pad = space(2 - len(Item_AC))
tell pad & Item_AC & " "
pad = space(5 - len(Item_Value))
tell pad & Item_Value & " gold "
note left(Item_Description, MaxColumns - 22)

Of course you would need to adjust your own column values to make sure it all fits and make sure that the total length of an items name, value, etc. doesn't go over the space you provide for it. If it does, then you will get something like space(5 - 7), which will crash. The last item in the list is designed to show as much of a description as possible for the line. It results in a line that is 79 characters, this is so that you don't get a line wrap resulting from the last character hitting the 80th column and causing two charage returns. It might do this, or it might not, but I prefer to avoid the risk or wondering why every line got doublespaced do to such a mistake. ;)

In any case, it simply comes down to figuring out 'how' you want stuff to appear and setting the right kind of padding to make it do it. numbers get padding added to the left, while strings have it added on the right. Simple. ;)
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 31 Aug 2003 07:01 AM (UTC)

Amended on Sun 31 Aug 2003 07:02 AM (UTC) by Nick Gammon

Message
Quote:

Umm. Think you missed the point there Nick.


In April, you mean?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #7 on Sun 31 Aug 2003 06:17 PM (UTC)
Message
Sigh.... Well, when people reply to posts that are that old... lol

Seriously though, there is no imeddiate way on here to tell 'which' post out of a group of them are new besides the date. I am used to most forums marking them visually in some way that is immediately obvious. Sigh...
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


31,264 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.