mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2010
Posts: 4
X
xRift Offline OP
Self-satisified door
OP Offline
Self-satisified door
X
Joined: Jan 2010
Posts: 4
Hello. Id like to suggest the ability to use custom alias' in the sockname section of the socket events. I think this is a good idea because it allows users to configure their scripts in a more organized and foolproof way. This also makes it where you can have a sort of configuration mechanism that would make it easier to distribute the script and have the end user customize say in this case the socket names in one place instead of multiple areas in the script which could lead to them either missing one of the areas that needed to be updated, or misspelling it in one or more areas. Here is some example code

Code:
;this fits into my Constants section of my script this particular
;alias will return constants related to sockets in my script
;in this case it will echo ghost if i invoke $sock_defs(sock_prefix)
;
alias sock_defs {
  if ($1 == sock_prefix) {
    return ghost
  }
}


later on in my code id like to be able to use socket events like this...
Code:
on *:sockopen:$sock_defs(sock_prefix): {
....
}


as of right now i have to use the following to achieve the same result
Code:
on *:sockopen:ghost: {
...
}


Im sure it could be said that this isnt a very important feature to add but I am a very organized coder and script in mirc as a hobby because it's where it all started for me. Im a big fan of the MVC coding approach and i like to make all my code very flexible and organized. I hope ive described this request to the best of my ability but if not please let me know and i will do my best to better explain anything that may have not been explained clearly enough. Thank you for reviewing my suggestion smile

Joined: Mar 2008
Posts: 93
B
Babel fish
Offline
Babel fish
B
Joined: Mar 2008
Posts: 93
Did you try $(...) Syntax?

Code:
alias sock_def {
  return ghost
}

on *:sockopen:$($sock_def): {
  ...
}

Seems to work fine for me.

Joined: Jan 2010
Posts: 4
X
xRift Offline OP
Self-satisified door
OP Offline
Self-satisified door
X
Joined: Jan 2010
Posts: 4
Wow okay never knew about $() perfect solution, and here im always preaching about reading the helpfile, i never noticed $() thank you it solves my problem here. smile


Link Copied to Clipboard