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
➜ Checking for names in a variable
|
Checking for names in a variable
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Giz
(10 posts) Bio
|
| Date
| Thu 09 Aug 2007 01:15 AM (UTC) |
| Message
| Hi Im quite new to scripting been doing it awhile and i've managed to get what i needed working but now i run into a wall.
what i want to do is with a script cast def spells on people comming and asking for it but only to people in the variable
this is what i've been trying to do but it wont work:
sub doRess (name, output, argv)
Dim who
Dim friends
Dim friendlist
who = argv(1)
friends = World.getVariable ("friends")
friendlist = Split(friends,"|")
if who = ("friendlist") then
World.Send "cast summon player ghost " & who & " "
World.doAfter 3, "cast resurrect " & who & " "
World.doAfter 5.2, "cast lolths sanctification " & who & " "
else
world.send "tell " & whot & " sorry no ress"
End if
End sub
any suggestions?
/Giz | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #1 on Thu 09 Aug 2007 01:25 AM (UTC) |
| Message
| One thing that would be helpful is to explain more precisely why it's not working; just saying "it doesn't work" doesn't let us help you very, well, helpfully. :)
You should try looking into the InStr function to see if one string is in another, though. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Thu 09 Aug 2007 05:59 AM (UTC) |
| Message
| Your variable friendlist is an array, after you create it with Split.
Thus, you want something along these lines to see if a name is in it:
isfriend = vbFalse
For Each name In friendlist
If who = name Then
isfriend = vbTrue
EndIf
Next
If isfriend Then
Send "cast summon player ghost " & who & " "
DoAfter 3, "cast resurrect " & who & " "
DoAfter 5.2, "cast lolths sanctification " & who & " "
Else
Send "tell " & who & " sorry no ress"
EndIf
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Giz
(10 posts) Bio
|
| Date
| Reply #3 on Thu 09 Aug 2007 11:52 AM (UTC) |
| Message
| That works perfectly thanks nick
/Giz | | 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.
15,841 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top