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
➜ Call on numbered aliasas
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Sun 08 Jun 2003 11:06 PM (UTC) |
Message
| Grrrr So many problems trying to do so many things too..
I've setup Aliasis from G1 to G65
Each one is enabled
Ignore Case
Expand Varible
and in the group GUIDE
And each one sends a message such as
G1 = TELL @GUIDEE Welcome to The Game
G2 = TELL @GUIDEE My name is @myname. I will be your guide.
etc.
but the problem now is sitting there typing G1 to G65 without forgetting where you were at. holding afew conversations and walking around
Kinda hard. :(
So I tried to make aliases called GNEXT and GPREV that would take the varible GNUM and add 1 to it and send G# to the mud so I could just type GNEXT over and over till I get to 65
and then have a GRESET command to reset it back to the beginning.
As well as GPREV in case I need to repeat something.
Is there anyway to add a world.note to an alias so that It will show which number it is as well?
Thanks,
WRTIII | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 09 Jun 2003 02:07 AM (UTC) Amended on Tue 10 Jun 2003 07:49 AM (UTC) by Nick Gammon
|
Message
| What I would do is put the messages into variables, not aliases, with a logical name (like you have), eg.
MSG1 = Welcome to The Game
MSG2 = My name is @myname. I will be your guide.
Then your "gnext" alias would take a message number (you could store one for each person you are helping).
Something like this:
'
' find where this person is up to
'
num = world.GetVariable ("guidee_" & name)
'
' first time - num will be empty
'
if IsEmpty (num) then
num = 1
end if
'
' Get the appropriate message
'
msg = world.GetVariable ("MSG" & num)
'
' tell the player
'
world.send "Tell " & name & " " & msg
'
' add 1 to message number, save for next time
'
num = num + 1
world.SetVariable "guidee_" & name, num
For instance, if you were helping Nick the variable "guidee_Nick" would be 1 (then 2, 3 and so on).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Reply #2 on Mon 09 Jun 2003 10:33 PM (UTC) |
Message
| I am still lost somewhat I think I pretty much understand what you mean.. but..
Ok So for now I manually make the varible Guidee_Nick
and I have an Alias GNEXT which calls on Sub routine GNEXT
Sub Gnext (a, b, c)
'
' find where this person is up to
'
num = world.GetVariable ("guidee_" & name")
'
' first time - num will be empty
'
if IsEmpty (num) then
num = 1
end if
'
' Get the appropriate message
'
msg = world.GetVariable ("MSG" & num)
'
' tell the player
'
world.send "Tell " & name & " " & msg
'
' add 1 to message number, save for next time
'
num = num + 1
world.SetVariable ("guidee_" & name, num)
I just copied and pasted for the time being but now when I type Gnext, How does it know who I am guiding? Ack I am confused lol I know I am a pain in the ass.
First error I got with that though is...
Error number: -2146827255
Event: Execution of line 144 column 44
Description: Unterminated string constant
Line in error:
num = world.GetVariable ("guidee_" & name")
Called by: Immediate execution
So I took the third " out..
Then I get
Error number: -2146827244
Event: Execution of line 169 column 42
Description: Cannot use parentheses when calling a Sub
Line in error:
world.SetVariable ("guidee_" & name, num)
Called by: Immediate execution
And it is there that I am stuck.. and now confused because I've been trying to figure this darn this out and not getting anywhere.. I wish I knew what I Was doing lol... please help
Thanks
WRTIII
Oh, If I remove the brackets from line 169 I get...
Error number: -2146827274
Event: Execution of line 170 column 1
Description: Expected 'End'
Line in error:
Called by: Immediate execution
| Top |
|
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Reply #3 on Mon 09 Jun 2003 10:53 PM (UTC) |
Message
| Ok I am using right now...
Sub Gnext (a, b, c)
'
' find where this person is up to
'
num = world.GetVariable ("guidee_" & name)
'
' first time - num will be empty
'
if IsEmpty (num) then
num = 1
end if
'
' Get the appropriate message
'
msg = world.GetVariable ("MSG" & num)
'
' tell the player
'
world.send "Tell " & name & " " & msg
'
' add 1 to message number, save for next time
'
num = num + 1
'world.SetVariable ("guidee_" & name, num)
'
' Had to comment this out because I get the error,
'Description: 'Cannot use parentheses when calling a Sub
'
End Sub
But When I type in my alias GNEXT Now It sends to the world
*
Tell
You chatter away to yourself.
*
So it's sending the tell part... now it just needs to send the name of who to send it to and the correct MSG#
I will keep trying to get it working but this is as far as I have gotten so far.
Thanks for any help
WRTIII | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #4 on Tue 10 Jun 2003 07:47 AM (UTC) |
Message
| Well, I gave you a snippet, not the whole thing. For instance, you need to establish the name.
I was imagining you would have an alias like this:
gnext *
So you might type "gnext nick". Then the alias gets the name from wildcard 1, eg. like this:
sub gnext (name, output, wildcards)
dim name
name = wildcards (1)
' then the rest I did before
end sub
You don't need to manually set up the variable first, the snippet I gave you takes care of that by checking for an empty guidee number, if it is empty the variable doesn't exist, so it starts at 1. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #5 on Tue 10 Jun 2003 07:49 AM (UTC) |
Message
| Sorry about the other errors, that was untested code.
There was a " too many, you are right, and in the "setvariable" line you don't need the brackets, as the error message said. I have fixed my earlier post. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Reply #6 on Tue 10 Jun 2003 10:27 PM (UTC) |
Message
| Thank you I got it working great now.
sub gnext (nme, output, wildcards)
Dim name
name = wildcards (1)
num = world.GetVariable ("guidee_" & name)
if IsEmpty (num) then
num = 1
end if
G = world.GetVariable ("G" & num)
world.send "Tell " & name & " " & G
num = num + 1
world.SetVariable "guidee_" & name, num
End Sub
The only problem I came across it that using the varible name and name in the sub part seemed to cause an error so I changed it in the sub to NME
If that is bad or going to cause a problem please let me now I do now understand that part of the sub except the last part is what the any wildcards will be called in that sub I believe.
Thanks again
WRTIII | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #7 on Wed 11 Jun 2003 07:46 AM (UTC) |
Message
| Ah yes, more untested code.
You are right, you can't use "name" in the two ways I did. You are right to rename one of them.
I didn't quite understand your last question - the wildcards are passed into the sub as an array, which is the third argument. Thus wildcards (1) is the first wildcard. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Reply #8 on Wed 11 Jun 2003 10:30 PM (UTC) |
Message
| Yes but if I was to do
Sub (A, B, C)
then
C (1)
would be the first wildcard correct?
As in I can name the wildcard arry anything I want and it will work the same as long as I use the same name throughout the whole sub.
| 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.
28,146 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top