[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Upper to lower case
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Upper to lower case

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


Posted by Penguin   (46 posts)  [Biography] 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?
[Go to top] top

Posted by Vaejor   (120 posts)  [Biography] 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 
[Go to top] top

Posted by Penguin   (46 posts)  [Biography] 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"
[Go to top] top

Posted by Vaejor   (120 posts)  [Biography] 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 
[Go to top] 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.


3,928 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]