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
➜ General
➜ Description Wardrobe and Scripting
Description Wardrobe and Scripting
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Balerion
(18 posts) Bio
|
Date
| Mon 05 Jan 2004 12:52 PM (UTC) |
Message
| Hello,
Until recently, I've stored character descriptions on my character object (PennMUSH system) and changed them as needed using some code I made. However, I'd prefer to be able to have the descriptions off-line rather than leading to <Output flushed> messages when I examine myself.
The system I currently use is involves storing the descriptions in attributes named <Name of Character>_Body## and so on, where <Name...> is the name of a character; sometimes I switch to other names to play other roles temporarily, so I have descriptions for those characters. My @desc contains a function that will look at three attributes (BODY, CLOTHES, EXTRA), where I store the name of the piece of desc I want (i.e., BODY: BODY01; CLOTHES: PANTS02; EXTRA: INSPECT01), and then grab them from me depending on my present name and which of the three I use (Sometimes I only use one part, more usually two, and sometimes three; and I suppose if it's possible having an unlimited number of variables would be best).
It seems to me that scripts might offer a solution.
Can scripts in MUSHclient pull data from plain text files (rather than databases), with minimal formatting so that it can parse them? I was thinking something like having a file for each character name, such as John_Doe Descs.txt. Then the descriptions for that character might be stored in a format like:
BODY01
<Description>
-
BODY02
<Description>
-
etc.
When I change desc, the script will recognize the name I currently have and pull from the appropriate file, setting each part of the desc into an attribute of the kind DESC_BODY, DESC_CLOTHES, etc.
Which script system would be best suited for this, and are there any scripts already made that already do some of the things I'm looking for?
Thanks. | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #1 on Mon 05 Jan 2004 05:19 PM (UTC) |
Message
| Well the good news it yes. ;) There are I believe two ways. One option is (straight from the docs):
Sub ReadFiles
Dim fso, f1, ts, s
Const ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile("c:\testfile.txt", True)
' Write a line.
Response.Write "Writing file <br>"
f1.WriteLine "Hello World"
f1.WriteBlankLines(1)
f1.Close
' Read the contents of the file.
Response.Write "Reading file <br>"
Set ts = fso.OpenTextFile("c:\testfile.txt", ForReading)
s = ts.ReadLine
Response.Write "File contents = '" & s & "'"
ts.Close
End Sub
This shows the general method of writing to and reading from a text file.
The second option is ironically using the Microsoft.Jet database system. It is equipped with a text parsing engine, since some simple databases exported data in that format, instead of the more managable binary forms. Either way you end up using CreateObject. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Mon 05 Jan 2004 07:23 PM (UTC) |
Message
| MUSHclient supports an unlimited number of variables (within reason, eg. memory).
A simple approach would be to use the naming system you mention, but just store the descriptions in a variable (per name). Then it is just a case of doing world.GetVariable ("name") and sending that to the MUSH.
You can inspect the variables in the variable configuration window, and alter them when you want. |
- 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.
11,079 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top