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 ➜ VBscript ➜ creating multiline alias,timers from an alias

creating multiline alias,timers from an alias

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


Posted by Newborizor   (6 posts)  Bio
Date Fri 17 Sep 2004 06:31 AM (UTC)
Message
What Im trying to do is this.

I want an alias that I can use to create other multiline aliases or timers.

for example, I quite often am creating alias that collect items then sell them then go back to where i started.

for example

Alias
name - sellstuff

Commands
n
n
n
g all
s
s
sell all
s


What I want to have is an alias that i can use to create these other aliases quickly.

like I would want to type

makealias sellstuff nnng allssssell all
and have it create the above shown alias

I am very new to scripting and have only been able to come
up with this which is very rudimentary and not what i want.

i have an alias called makealias * *
in the command i have
World.addalias "", "%1", "%2", 1, ""

and i would have to type makealias "sellstuff" "n\nn\nn\ng all\ns\ns\nsell all\ns"

Top

Posted by Newborizor   (6 posts)  Bio
Date Reply #1 on Fri 17 Sep 2004 06:34 AM (UTC)
Message
well i couldnt figure out how to edit my message but my makealias is actually called

makealias "*" "*"
not
makealias * *
Top

Posted by Jlzink   USA  (15 posts)  Bio
Date Reply #2 on Fri 17 Sep 2004 06:54 AM (UTC)
Message
easily done...infact I have a script somewhere that does it
Top

Posted by Jlzink   USA  (15 posts)  Bio
Date Reply #3 on Fri 17 Sep 2004 02:09 PM (UTC)
Message
const eEnabled = 1 ' enable trigger
const eOmitFromLog = 2 ' omit from log file
const eOmitFromOutput = 4 ' omit trigger from output
const eKeepEvaluating = 8 ' keep evaluating
const eIgnoreCase = 16 ' ignore case when matching
const eTriggerRegularExpression = 32 ' trigger uses regular expression
const eExpandVariables = 512 ' expand variables like @direction
const eReplace = 1024 ' replace existing trigger of same name
const eTemporary = 16384 ' temporary - do not save to world file

const NOCHANGE = -1
const custom1 = 0
const custom2 = 1
const custom3 = 2
const custom4 = 3
const custom5 = 4
const custom6 = 5
const custom7 = 6
const custom8 = 7
const custom9 = 8
const custom10 = 9
const custom11 = 10
const custom12 = 11
const custom13 = 12
const custom14 = 13
const custom15 = 14
const custom16 = 15

'#Aliases
Alias 1: #ALIAS {alias name}{send line1;send line2, send line 3}

Alias 2: #TIMER {name}{hours:minutes:seconds}{SEND1;Send2}
sub addalias(a,b,c)
dim salias
salias = ""
gd = split(c(3),";")
for x = 0 to ubound(gd)
if salias = "" then
salias = right(gd(x),len(gd(x)) -1)
else
salias = salias & vblf & right(gd(x),len(gd(x)) -1)
end if
next
'end if

if salias <> "" then
World.addalias c(1), c(2), salias, eEnabled, ""
world.note "Alias added Successfuly!"
else
World.addalias c(1), c(2), salias, eEnabled, ""
world.note "Alias added Successfuly!"
end if
end sub

sub addtimer(a,b,c)
dim stimer
stimer = ""
'if c(3) like "*;*" then
gd = split(c(5),";")
for x = 0 to ubound(gd)
if stimer = "" then
stimer = right(gd(x),len(gd(x)))
else
stimer = stimer & vblf & right(gd(x),len(gd(x)))
end if
next


World.addtimer c(1),c(2),c(3),c(4), stimer, 1, ""
world.note "Timer Added Successfully!"
end sub
Top

Posted by Newborizor   (6 posts)  Bio
Date Reply #4 on Fri 17 Sep 2004 09:30 PM (UTC)
Message
Ok, I assume for this i need to use a script file (not put it all in aliases like i originally tried to do.)

Im still not quite understanding how this works.
I think what im foggiest on is how to add the actual
alias that calls the addalias script.. Im not sure what
to put as the name of it and such.

I tried calling it addalias * *
but if i type addalias testing nnng allsss
It makes the alias but the name of the alias is
"testing nnng allsss" and nothing is in the command area.
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #5 on Fri 17 Sep 2004 10:02 PM (UTC)
Message
Try this: (copy between <Aliases> and </Aliases> then click "paste" in the alias menu)

You need to have scripting enabled, and set to VBscript.

To use it for aliases,
addalias [match] [send]
and the send is a speedwalk string (for n n n look south you would enter: "nnn(look south)" so youll want to read up on that.

For timers, its
addtimer [hour] [minute] [second] [send]
and send is the same as above (a speedwalk).


<aliases>
  <alias
   match="^addalias (\w+) (.*)$"
   enabled="y"
   echo_alias="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>addalias &quot;&quot;, &quot;%1&quot;, &quot;%2&quot;, 2081, &quot;&quot;</send>
  </alias>
  <alias
   match="^addtimer (\d+) (\d+) (\d+) (.*)$"
   enabled="y"
   echo_alias="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>addtimer &quot;&quot;, %1, %2, %3, &quot;%4&quot;, 9, &quot;&quot;</send>
  </alias>
</aliases>

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Newborizor   (6 posts)  Bio
Date Reply #6 on Fri 17 Sep 2004 10:24 PM (UTC)
Message
Flannel, thanks so much!
I did what you said and it worked perfectly.
This is EXACTLY what I wanted to do.
Thanks again, and thank you for your help also
Jlzink.
Top

Posted by Newborizor   (6 posts)  Bio
Date Reply #7 on Sat 18 Sep 2004 12:10 AM (UTC)
Message
Well now ive run into another slight problem.

What I want to do is when i use the addtimer alias
i want it not only to create the timer, but also
create 2 aliases, one to enable the timer, one to disable it. Now, i've modified the addtimer alias to allow for a label, and added
world.SetTimerOption "%1", "group", "%1"
in order to assign the timer to a group.
%1 is the label of the timer i created.

then i added the code:
addalias "", "enable%1", "World.EnableTimer ""%1"", TRUE", 1, ""

to make my enabling alias. The only problem is i dont know how to set the alias Send To field to Script.
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #8 on Sat 18 Sep 2004 01:18 AM (UTC)
Message
Why dont you just create two aliases total.

^TimerOn (.*)$
^TimerOff (.*)$

then the wildcard is the timer name.
And youd send 'enabletimer "%1", 1' or 'enabletimer "%1", 0'
Rather than play around with a million aliases.

But for the record, you use setaliasoption to set the send location.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
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.


25,321 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.