[mIRC] Question about using same code across script files reddit / irc ---------------------------------------------------------------------- Zigress · 2016-08-09 22:54 Hello! Is it possible to use a command or code across different script files (such as .ini)? For example, if I have a !test command, is it possible to use that command on a different, locally stored script file instead of copy pasting the entire code? Is alias what I'm looking for? Thank you in advance. ---------------------------------------------------------------------- jumpking · 2016-08-09 23:15 You can reuse code across separate files loaded into mIRC, yes. There are some exceptions (such as making an alias local with the -l switch), but most things will function on a global scale. Variables can also be made global or local. http://en.wikichip.org/wiki/mirc/aliases#Local_Aliases http://en.wikichip.org/wiki/mirc/variables If you're having issues with something specific feel free to ask. I'm not sure how many other people that browse /r/irc are familiar with mirc script, but I'll certainly help if I can and when I'm at my computer. ---------------------------------------------------------------------- Zigress · 2016-08-09 23:44 Thanks! So lets say I have two script files in remote. One is called "Master Script" and the second one is called "Command." The command script executes a rather long command, but instead of copying all that code into the "Master Script" file, I want to create an public alias for it. This is what I did: alias command { [all the code here] } How do I call this alias in the other script? Sorry, I'm not too experienced with aliases. Thank you in advance. You have been a huge help. ---------------------------------------------------------------------- jumpking · 2016-08-10 00:27 You can call it simply by writing the name of the alias on a line in your script. I'll show you some examples: alias test123 { echo -ac info * The test123 alias has been called. } alias happy { ; This alias was mostly written to function as an identifier, to be called with ; like this: $happy .. depending on the result of $rand stored in %x it'll either ; return $true or $false. You can test it like this, in an mIRC window type: ; //echo -a $happy a few times and you should see both results eventually. var %x = $rand(0,1) if (%x == 0) { return $false } else { return $true } } alias foo { ; The test123 command below will run the 'test123' alias you see above. ; The code in the test123 alias (the echo statement) will be the output you ; see inside mIRC when using the /foo alias since it's listed first. test123 ; Then just for example sake I've used an echo to show that code inside this ; alias also gets called. echo -ac info * The foo alias has been called. ; Here is the 'happy' alias being used as an identifer instead of a command. if ($happy) { echo -ac ctcp * SMILE! } else { echo -ac ctcp * FROWN! } } The first thing to note here is that all 3 of these aliases can be placed in any Remote script thats loaded into mIRC. They can be put in 3 separate files, 2 in one file and 1 in another file, or all 3 in one file. They'll all function the same as long as there aren't any naming conflicts. (E.g. you shouldn't have an alias called "happy" in 2 different places, it should only exist once, to keep things simple.) If you type */foo* in a window in mIRC with these 3 scripts loaded, your output will look something like this (with the last line being SMILE! or FROWN! depending on the logic in the happy alias): * The test123 alias has been called. * The foo alias has been called. * SMILE! ---------------------------------------------------------------------- Zigress · 2016-08-10 00:36 Oh, ok. Understand this much, much better now. Thank you, again. Btw, PM-ed you, check whenever you can. Cheers.