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
➜ Help coloring text
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ashass
(50 posts) Bio
|
Date
| Tue 28 Dec 2010 08:11 AM (UTC) Amended on Tue 28 Dec 2010 08:12 AM (UTC) by Ashass
|
Message
| Been working on this for a bit now, finally got it to match everything right, except now I need to color the trigger text (but only when it matches the criteria that triggers the 'Enemy sighted!' message box.)
Trigger text:
Guts:
Dim db
Dim rs
Dim SQL
Dim check_enemy
Dim SplitName
Dim get_enemies
get_enemies = world.GetVariable ("War_Clan_List")
check_enemy = "%1"
check_enemy = Trim(check_enemy)
Do While InStr(1, check_enemy, " ")
check_enemy = Replace(check_enemy, " ", " ")
Loop
Do While InStr(1, check_enemy, " ")
check_enemy = Replace(check_enemy, " ", "___")
Loop
SplitName = Split(check_enemy, "___")
Set db = CreateObject("ADODB.Connection")
db.Open "DSN=ODBC_DRIVER;UID=USERNAME;PWD=PASSWORD;Database=DATABASE"
SQL = "SELECT affiliation FROM dsl.dbo.users WHERE username = '" & replace(SplitName(0), "'", "") & "'"
Set rs = db.Execute (SQL)
If Not (rs.BOF And Not rs.EOF) Then
If (instr(get_enemies, rs("affiliation") )) Then
MsgBox "Enemy Sighted!"
End If
End If
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
| Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 28 Dec 2010 08:31 AM (UTC) |
Message
| You could have the trigger omit from output, to get rid of the original, and the ColourNote with your desired colours, the original text which will be %0. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ashass
(50 posts) Bio
|
Date
| Reply #2 on Tue 28 Dec 2010 08:53 AM (UTC) Amended on Wed 29 Dec 2010 05:52 AM (UTC) by Nick Gammon
|
Message
| Worked beautifully. Thanks!
Hum, actually, small problem.. Other things have 'is here' in there, so I need to be able to... un omit them from output if they don't match the database, any idea how to do that?
=======
Nm, i got it,
If Not (rs.EOF) Then
If (instr(get_enemies, rs("affiliation"))) Then
world.ColourNote "black", "red", "%0"
Else
world.ColourNote "black", "green", "%0"
End If
Else
world.ColourNote "black", "gray", "%0"
End If
now i just need to find colors that aren't offensive... | Top |
|
Posted by
| Ashass
(50 posts) Bio
|
Date
| Reply #3 on Tue 28 Dec 2010 07:35 PM (UTC) |
Message
| Nick, is there a way to preserve the original line colors? That way when I omit the line I can color the name, then have the rest of the line the proper color?
I already have how to split out the name from the rest of the line, so all I need to know is how to retrieve the normal line color =) | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 29 Dec 2010 05:54 AM (UTC) |
Message
| It's easier in Lua <sigh> because the trigger can get the style runs which have the colours in them.
However you can get style runs of the last line ...
That gives you the colours which you can put back into your ColourNote calls. |
- 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.
20,728 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top