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
➜ conditional checking
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ignis
(26 posts) Bio
|
Date
| Thu 09 May 2013 04:46 AM (UTC) Amended on Thu 09 May 2013 05:02 AM (UTC) by Ignis
|
Message
| I've been setting up triggers to paste channels to a notpad window so that if I'm busy fighting and miss a message it's in another window to find instead of having to wade through scroll back. I'm familiar with vba to a certain extent but keep running into errors. The last channel I'm trying to get to append only shows a person's name and what s/he said.
<Name> the message that was sent
the only problem with doing a match on <*> * is that's also the format for most of the other prompts in game
<[892X] [7835H 13M] [14 Blood]>
The one thing I do know is the line for that channel will never start with <[, so I tried doing a check but I keep getting an error I don't quite follow.
Here's what I've been trying:
if len(world.replace(%1,"[","")) = len(%1) Then
world.AppendToNotepad "Trigger", %0
end if
and the error I got as this:
Execution of line 1 column 33
Immediate execution
Expected ')'
Line in error:
if len(world.replace([Crippled] [7835H 13M] [14 Blood],"[","")) = len([Crippled] [7835H 13M] [14 Blood]) Then
I tried adding in an extra ) at the 33rd character but that also didn't fix the issue, is there a way to make this script work? Also I think another issue here is not quite understanding replace and len as I've only really used those in excel/vba/ms office, is it possible to replace characters within a script the way i'm attempting to and then calculate the length of the string? | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 13 May 2013 12:10 PM (UTC) |
Message
| Can you paste the whole trigger?
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
Looks like this is the issue:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ignis
(26 posts) Bio
|
Date
| Reply #2 on Wed 15 May 2013 02:48 AM (UTC) |
Message
| Ah, it took me a bit to understand, but yes, that was it!
Finished version:
<triggers>
<trigger
enabled="y"
group="social"
match="<*>*"
send_to="12"
sequence="100"
>
<send>If (len (World.Replace ("%1","[","",1)) = len ("%1")) Then
World.AppendToNotepad "Trigger: ", "%0" & vbcrlf
end If
</send>
</trigger>
</triggers>
the "Trigger: " was to get it to paste to the same notepad window as a few triggers I have that are "send to notepad(append)" instead of "send to script". I might work on converting the others to script as well to clean it up, but the one tip really did help. | 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.
16,233 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top