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
➜ Stealing double values
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Kelson
(5 posts) Bio
|
Date
| Sun 08 Dec 2002 01:43 AM (UTC) |
Message
| Magnum once made a database program for saving his equipment sets. Using his work (and very, very heavily modifying it...ie, using only his notecolor function now) I made a vbscript plugin that takes all the characterists of an item spit out from the mud. It takes this data, checks if the file exists first (if it does it adds a few of the changing variables to it) and if it doesn't it makes a .txt file. The problem comes with lines with two variables in it. For instance:
Value: 5 gold 3 silver Level: 5
Currently, I have a work around in place. Using the file-system object, I create a .txt file, write the entire line in, then selectively read and store parts of the line, ending up by deleting the file. Since I can't double up triggers for the line (which is how I'm capturing information).
The system, basically, match Value: * and save in value_object. Then write value_object to blerb.txt. Read first part of file then store in value then read second part (level part) and store in level.
If someone could tell me how to double up the take without doing this, it'd be appreciated.
(btw, actually matches, Value: * Level: * and prints %1 %2) | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #1 on Sun 08 Dec 2002 06:26 PM (UTC) Amended on Sun 08 Dec 2002 06:27 PM (UTC) by Shadowfyr
|
Message
| Well... Since I assume it could be anything from:
Value: 5 gold 3 silver Level: 5
to
Value: 5 gold Level: 5
to
Value: 5 gold 3 silver 1 copper Level: 5
this is not terribly easy. There is no separator to easilly tell which parts belong to which item.. However.. One option would be something like:
dim temp
temp = split(wildcard(1)," ")
Now as to what this does is, if you match on a line like 'Value: 5 gold 3 silver Level: 5' and it returns two wildcards>
wildcard 1: 5 gold 3 silver
wildcard 2: 5
The above code split the first wildcard into an array:
temp(0) = 5
temp(1) = gold
temp(2) = 3
temp(3) = silver
You can then step through the array to get the actually amounts like:
gold = 0
silver = 0
for count = 0 to ubound(temp)
if isnumeric(temp(count)) then
tval = temp(count)
else
if temp(count) = "gold" then
gold = tval
else if temp(count) = "silver" then
silver = tval
end if
end if
next
| Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Sun 08 Dec 2002 07:42 PM (UTC) |
Message
|
Quote:
Since I can't double up triggers for the line ...
What do you mean by that? You can have more than one trigger, if you check the "keep evaluating" flag. Then you can have multiple triggers do a pass over a single line. |
- 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,235 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top