Register forum user name Search FAQ

Gammon Forum

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 ➜ General ➜ Upper to lower case

Upper to lower case

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Penguin   (46 posts)  Bio
Date Mon 27 May 2002 01:56 AM (UTC)
Message
Hi! I've been trying to make an alias to send "trigger Loser todo hunt loser" I tried to write a script which turned out something like this:

Sub OnHunt (strTriggerName, strLine, arrWildCards)
person1= arrWildcards (1)
person1= ucase (person)
person = arrWildcards (1) '
person = lcase (person) '
World.Send "trigger person1 todo hunt " + person
End Sub

Alias: pkhunt *
Expand variables checked
Label: PK_hunt
Script: OnHunt

However if I typed pkhunt loser, the mud registers it as trigger person1 todo hunt loser
Do you know what the problem is here?
Top

Posted by Vaejor   (120 posts)  Bio
Date Reply #1 on Mon 27 May 2002 02:09 AM (UTC)
Message
The first thing is that 'person1' should be added into the string similar to how you did it with 'person'

I also changed the 'ucase (person)' to 'ucase (person1)' as I believe you meant to do.


Sub OnHunt (strTriggerName, strLine, arrWildCards)
  person1 = arrWildcards (1)
  person1 = ucase (person1)
  person  = arrWildcards (1) '
  person  = lcase (person) '
  World.Send "trigger " + person1 + " todo hunt " + person
End Sub 



The second thing, is that UCase() in VBScript will capitalize the whole word. The output you probably want is as follows:


Sub OnHunt (strTriggerName, strLine, arrWildCards)
  person1 = arrWildcards(1)
  person1 = ucase(Left(person1, 1)) + lcase(Mid(person1, 2, Len(person1)))
  person  = arrWildcards(1)
  person  = lcase(person)
  World.Send "trigger " + person1 + " todo hunt " + person
End Sub 



And for a final possible product:


Sub OnHunt (strTriggerName, strLine, arrWildCards)
  Dim person
  
  person = arrWildcards(1)
  person = UCase(Left(person, 1)) & LCase(Mid(person, 2, Len(person)))

  World.Send "trigger " & person & " todo hunt " & LCase(person)
End Sub 
Top

Posted by Penguin   (46 posts)  Bio
Date Reply #2 on Mon 27 May 2002 09:58 AM (UTC)
Message
Hmm.. what if I want to use this alias on a previously set variable? Let's say I have a target "penguin" Do you think there is anyway I can set an alias "h" using VBscript to send "trigger Penguin todo hunt penguin"
Top

Posted by Vaejor   (120 posts)  Bio
Date Reply #3 on Mon 27 May 2002 02:23 PM (UTC)
Message
Depending on if you're using an internal MushClient variable, or a global VBScript variable, delete the incorrect line.


Dim target_name   ' Only needed if you store it as a global variable in the VBScript instead of a MushClient variable

Sub OnHunt (strTriggerName, strLine, arrWildCards)
  Dim person
  
'  person = arrWildcards(1)                    ' Don't pull it from the trigger/alias data
  person = world.GetVariable("target_name")    ' Data is stored in a MushClient variable
  person = target_name                         ' Data is stored in a VBScript global variable
  person = UCase(Left(person, 1)) & LCase(Mid(person, 2, Len(person)))

  World.Send "trigger " & person & " todo hunt " & LCase(person)
End 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.


16,112 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.