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
➜ VBscript
➜ Search Script
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| DanPrice
Australia (3 posts) Bio
|
| Date
| Sat 01 Jun 2002 03:11 PM (UTC) |
| Message
| okay, another question for you guys:
I have logged all of the information on items in the mud I play into one big text file, with each thing seperated by a enter, e.g:
Object 'the Cloak of Shadows', Item type: OTHER
Item will give you following abilities: NOBITS
Object 'thracian half-armor', Item type: ARMOR
Item will give you following abilities: NOBITS
Now i am trying to make a script to search through this for an item name (e.g. 'the cloak of shadows') and then display the results. So far all I can do is open the file and read the lines. Any suggestions on how to go about matching on the item name and displaying its info? |
Would you like some gum?
Go on, its spearmint flavour.... | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #1 on Sat 01 Jun 2002 08:27 PM (UTC) |
| Message
| | Hmm. Not sure. I assume that the names are added as you found them and not sorted. If they are sorted then there may be a fairly efficient way to do it, but unsorted you are going to waste an insane amount of time hunting for each match. In either case I haven't done much with file access in scripts, so am not sure if it can even be done. Also.. In the old QBasic there where file setting from reading 'records', but you either had to use a fixed length and read the data as a specific type with the same size, read it sequentially every time, or avoid things like ',', because it treated ',', ':' and enter as seperate records. It isn't likely to be easy this way. A better solution would be to hunt through these forums for a set of posts on accessing databases from in scripts. Since the drivers for ODBC support both searching, automatic sorting and executes outside the client, there should be a minimum speed penalty when using it, compared to trying to use a text file. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Sun 02 Jun 2002 10:06 PM (UTC) |
| Message
| Depending on the quantity you could add them as MUSHclient variables. That would give a direct lookup (by name).
Alternatively, and perhaps quicker, do what Shadowfyr recommended and use a database. There was a post about that. You could use MySQL which is free. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
14,206 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top