Welcome Guest | RSS
General mIRC Tutorial (In Process) - mIRC Land
Home | General mIRC Tutorial (In Process) - mIRC Land | Sign Up | Log In
I have removed the ads. Any ads you see are by ucoz.
 
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum moderator: Wikked  
mIRC Land » mIRC Scripting Tutorials, Help, Requests » Tutorials » General mIRC Tutorial (In Process) (This is an on going tutorial with thr basics of mIRC Scripts)
General mIRC Tutorial (In Process)
OrFeAsGrDate: Thursday, 22/03/2018, 5:41:53 PM | Message # 1
OrFeAsGr -- http://humanity.ucoz.com --
Group: Administrators
Messages: 6
Reputation: 0
Status: Offline


Hello Scripters
Welcome to this FAQ of mIRC Scripting! Be sure to check back for newer entries.. Not completed yet smile




F.A.Q Questions List:


Question #1 So.. i have this bot i'm making and i want to make it respond tome when i say certain things. How do i do that?




Question # 2 So.. i need to make a script that will reply with a private message when someone sends me one. How would I do that?


Question #3.1 Remember that ON TEXT you talked about? It's cool. But some chatters started spamming me and i flooded the channel and then got kicked out! What can i do to reduce the replies???


Question #3.2 Delay/ Cooldown for ON *:TEXT:*:#: event




Question #1



So.. i have this bot i'm making and i want to make it respond tome when i say certain things. How do i do that?




Piece of cake... The event that triggers in mIRC when someone sends a message is named TEXT.


So see here the formats of the event.


ON *:TEXT:word:#channel:


The first * is always the user lvl.


(You can set different user levels for nicks in the users tab in the remotes.)


TEXT is the event that triggers on a message.


Word can be either a * which means any text at all but you can use "if statements" to control the response.


Or a word, or a combination of (a) word(s) and * that is called wildcard.


#channel is the channel name you want it to work in. A lone # would mean it should work in any channel.


Let's see all these.


ON *:TEXT:test:#: {
msg $chan Good Job $nick you made your first script!
}


This will trigger when someone sends ONLY the word test in any channel you're in.


ON *:TEXT:test*:#: {
msg $chan Good Job $nick you made your first script!
}



This would trigger when someone would send a message that started with test and continued with other words.


*test would trigger when it ended in test.


And *test* when somewhere in the message there was a "test"



ON *:TEXT:*:#: {
if ($1 == test) {
msg $chan Good Job $nick you made your first "if" script!
}
}



I strongly suggest using if statements but you can do whatever you like.


This will trigger when someone sends a message whose 1st word is test to any channel you're in. The identifiers $1 $2 $3 and so on return the 1st 2nd and 3rd word respectively. $1- Returns all the words. $2- returns all the words from the 2nd and up.. and so on! $nick always ,in all the mIRC events that are triggered by a user, returns the nickname of the user.


Easy right?




Question #2




So.. i need to make a script that will reply with a private message when someone sends me one. How would I do that?




Remember TEXT event? Guess what! You only need a small adjustment to make it work for private messages.


For a channel message we used this format: ON *:TEXT:*:#:


For a private message we will use this format: ON *:TEXT:*:?:


So let's see the same example for a private message.


ON *:TEXT:*:?: {
if ($1 == test) {
msg $nick $nick Please keep your "test" out of my private messages. Thanks!
}
}



This will respond to a private message whose 1st word is test.


(NOTE: You can make text trigger for both channel and private messages using this format. ON *:TEXT:*:*: )





Question #3.1




Remember that ON TEXT you talked about? It's cool. But some chatters started spamming me and i flooded the channel and then got kicked out! What can i do to reduce the replies???



Trust me! Every scripter has been there. The solution is a piece of cake! And it's "variables".
Variables are temporary storage areas to which you can assign values which you can use later in your scripts.
To give a value to a variable you simply do:


set %varname value


The variable name needs to start with a % . Other than that the name can be anything you want. Including numbers, letters, symbols. Value can be also anything BUT it can't exceed 4000 characters smile


For this question we will use a simple value. 1 . Because we don't care about the value but only about either it exists or not. Check this out! wink


ON *:TEXT:*:#: {
if ($1 == test) {
if (!%msgsend) {
set -u25 %msgsend 1
msg $chan Your test works $nick . Good Job!
}
}
}


HEY! HEY! Dude! Wait up. What is -u25 and why so many { and } . I'm a beginner! Explain, will ya?


Excuse me! I will explain everything right now!


As you may or may not know.. you can nest if statements in other if statemets!


So what this script does is:


  • It triggers on a channel message.

  • If the 1ST word is "test" (without quotes) it goes to the next line.

  • If the %msgsend variable doesn't exist, it goes to the next line. ( the ! operator negates a value.)

  • It then gives the value 1 to the variable %msgsend . But it uses the -u switch.

  • The -uN switch automatically unsets the variable after N seconds. Where N can be any number.

  • So in our case, the variable %msgsend will be unset in 25 seconds.

  • It then sends the msg to the channel.

  • The following 3 brackets are closing brackets which close the 3 "opening brackets".


  • So, when someone sends a channel message this script will reply once and then it won't reply for the next 25 seconds.


    It's simple right?



    Question #3.2




    Great tutorial! (thank you :D) . But listen, now i had an idea. I need the previous script to have a delay sepearately for each channel and nick.




    Remember the if statements. Nice ah? Well we are going to use these and the identifiers $+() and $()


    Let's explain the $+() first smile


    In mIRC Scripting the identifiers such as $nick $chan etc. do not work if you stick them between other words, numbers, characters in general. For example. $nick returns the nick that triggered the event. what$nick does not return nothing but... what$nick . If you want to combine the value that an identifier or variable returns with other characters you need $+()


    Let's say John sends you a message. So $nick returns John. If you want to combine John with the word "idiot-" you can do it this way: $+(idiot-,$nick) .


    -Hold on dude. Why will that work? and idiot-$nick won't??


    Because.. that's what $+( does. you seperate plain text from variables or identifiers with the use of a comma.


    Now let's explain $() . Where you'll need this? Let's see.
  • set $+(%,msgsend,$nick) 1

  • If John sends you a message and you use this line in the TEXT event it will set this variable: %msgsendJohn . And it will give the value 1.

  • Now to make comparisons with if statements, you need to "get" the value of that variable. That's where $() comes in.

  • Simple: you write the $+(%,msgsend,$nick) inserted in $( ,2) . It should look like this: $($+(%,msgsend,$nick),2)

  • $($+(%,msgsend,$nick),2) Will return 1. which si the value we gave to the variable.


  • Got it right? Now let's apply this to the script.



    ON *:TEXT:*:#: {
    if ($1 == test) {
    if (!$($+(%,msgsend,$nick),2)) {
    if (!$($+(%,msgsend,$chan),2)) {
    set -u25 $+(%,msgsend,$nick) 1
    set -u25 $+(%,msgsend,$chan) 1
    msg $chan Your test works $nick ,with a seperate delay for Nicks and chans. Good Job!
    }
    }
    }




    How People Treat Others Is A Direct Reflection Of How They feel About Their Selves ---- http://humanity.ucoz.com ----
     
    mIRC Land » mIRC Scripting Tutorials, Help, Requests » Tutorials » General mIRC Tutorial (In Process) (This is an on going tutorial with thr basics of mIRC Scripts)
    • Page 1 of 1
    • 1
    Search:

    Copyright MyCorp © 2018