mIRC Home    About    Download    Register    News    Help

Print Thread
Help with Shortening an alias #190417 20/11/07 06:07 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hello,

I know that some of the criteria in this alias is quite long, however I'm asking the scripters and programmers out there, if there is a more efficent, faster and small way or method of doing this, I will explain how it should work


I am Half Op or HelpOp for a network, and would like to close a channel

1. UNLOCKS the PROPERTIES
2. NULLS THERE VALUES, in case some are set
3. LOCKS THEM again to prevent anyone changing them


alias closeroom {
PROP # UNLOCK CATEGORY | PROP # UNLOCK HOSTKEY | PROP # UNLOCK LANGUAGE | PROP # UNLOCK LANGUAGE2 | PROP # UNLOCK ONJOIN | PROP # UNLOCK ONPART | PROP # UNLOCK OWNERKEY | PROP # UNLOCK TOPIC
prop # ownerkey : | prop # hostkey : | prop # memberkey : | prop # onjoin : | prop # onpart : | prop # category UL
PROP # LOCK CATEGORY | PROP # LOCK HOSTKEY | PROP # LOCK LANGUAGE | PROP # LOCK LANGUAGE2 | PROP # LOCK ONJOIN | PROP # LOCK ONPART | PROP # LOCK OWNERKEY | PROP # LOCK TOPIC
}

any help is greatly appreciated.

Last edited by Buggs2008; 20/11/07 06:07 PM.
Re: Help with Shortening an alias [Re: Buggs2008] #190419 20/11/07 07:14 PM
Joined: Oct 2007
Posts: 51
T
Trashlord_ Offline
Babel fish
Offline
Babel fish
T
Joined: Oct 2007
Posts: 51
Make a text file - prop.txt
In this text file, store all the commands.
UNLOCK <something>
UNLOCK <something else>
UNLOCK <more unlocks blah etc>
OWNERKEY :
HOTSKEY :
MEMBERKEY :
ETC :
LOCK <something>
LOCK <more>
LOCK <etc>

instead of <somethings> insert the parameters.
then
Code:
alias closechan {
var %chan = $1, %lines = $lines(prop.txt), %i = 0
while (%i < %lines) {
inc %i
PROP %chan $read(prop.txt,%i)
}
echo -a *** Channel closed: $+(%chan,.)
}


I hope you understand what I mean, if not, ask again.

Re: Help with Shortening an alias [Re: Buggs2008] #190421 20/11/07 07:25 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
this makes it only more clear, but not shorter smile
anyway:
Code:
alias closeroom {
  var %locks = category, hostkey, language, language2, onjoin, onpart, ownerkey, topic
  var %null = ownerkey :, hostkey:, memberkey :, onjoin :, onpart :, category UL

  var %unlock.nr = 1, %null.nr = 1, %lock.nr = 1
  while ($gettok(%locks,%unlock.nr,44)) { PROP # UNLOCK $v1 | inc %unlock.nr }
  while ($gettok(%null,%null.nr,44)) { PROP # $v1 | inc %null.nr }
  while ($gettok(%locks,%lock.nr,44)) { PROP # LOCK $v1 | inc %lock.nr }
}

Re: Help with Shortening an alias [Re: Buggs2008] #190423 20/11/07 07:35 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hey, thats a cool suggestion too, its cool to see the ways that this can be re-written.