#MIRC @ Dalnet
Would you like to react to this message? Create an account in a few clicks or log in to continue.
#MIRC @ Dalnet

MIRC Client Help Forum

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Dalnet Services Help Popups
Scripting Class Level 2 Class 1 EmptyMon Oct 24, 2011 7:16 am by HorseC

» DCC Problem Checking Script
Scripting Class Level 2 Class 1 EmptyFri Sep 30, 2011 11:43 pm by Rukbat

» general question
Scripting Class Level 2 Class 1 EmptyFri Sep 30, 2011 5:25 am by Rukbat

» Banned by dal.net
Scripting Class Level 2 Class 1 EmptySat Aug 13, 2011 11:25 pm by HorseC

» "MISHBOX" tutorials on mirc scripting.
Scripting Class Level 2 Class 1 EmptyTue Aug 02, 2011 7:16 am by HorseC

» A very good guide to mIRC Scripting
Scripting Class Level 2 Class 1 EmptyTue Aug 02, 2011 7:08 am by HorseC

» Dialog tool for DALnet services
Scripting Class Level 2 Class 1 EmptyMon Aug 01, 2011 7:53 am by HorseC

» Scripting Class Level 2 Class 4
Scripting Class Level 2 Class 1 EmptySat Jul 30, 2011 1:01 am by HorseC

» Scripting Class Level 2 Class 3
Scripting Class Level 2 Class 1 EmptySat Jul 30, 2011 12:49 am by HorseC

Gallery


Scripting Class Level 2 Class 1 Empty
Statistics
We have 32 registered users
The newest registered user is boed1

Our users have posted a total of 38 messages in 36 subjects

You are not connected. Please login or register

Scripting Class Level 2 Class 1

Go down  Message [Page 1 of 1]

1Scripting Class Level 2 Class 1 Empty Scripting Class Level 2 Class 1 Fri Jul 29, 2011 11:36 pm

HorseC

HorseC

Hello and welcome to Level 2, Class 1,
of the Script-School Program.

This level is going to focus on the
IF - Then - Else concept and logic.

It will also cover the use of $rand and
$read. These are very useful functions.

This level is more complex so it is
very important that you attend ALL
of the classes.

We offer this class twice a week, so if you
are not able to attend one of the classes,
try to attend the other class.

This is a fast paced class and you will
need to pay close atttention.
Please be sure that you log these classes
so you may review them at your convience.

We are going to ask that you please follow
the instructions EXACTLY while in class.

I know its fun to do little changes to the
examples, but the instructors are looking for
specific responses to the examples. This way
they know that you have been able to do the
scripting example up to that point.

Because this is such a fast paced and complex
class, we will start class on time. If you are
more than 5 minutes late, you will not be admitted
into the class.

If you are in the class and
for some reason disconnect, we will re admit you.
We do recommend that you join the #script-school
channel at least 10 minutes before class, so
that we will have a chance to admit you to class,
before class starts.

All of the regular school rules still apply, and of
course to avoid lag, we will ask you all to be
on the same irc server.

While this level is complex, it will also be
a fun and wild level. We will have a lot of fun
as we go.. so hang on and log everything Wink

.. Lets Get Started...

We are first going to cover an function called
$rand(X,Y). This identifier will choose a random
letter or number between "X" and "Y" (Inclusive)

- From the Help File -

$rand(v1,v2)

This works in two ways. If you supply it with numbers
for v1 and v2, it will return a random number between
v1 and v2. If you supply it with letters, it will
return a random letter between letters for v1 and v2.

$rand(a,z) returns a letter in the range a,b,c,...,z
$rand(A,Z) returns a letter in the range A,B,C,...,Z
$rand(0,N) returns a number in the range 0,1,2,...,N

Lets try these out in the lab.

Type 12//say $rand(0,5)
Type 12//say $rand(a,z)
Type 12//say $rand(A,Z)
Type 12//say $rand(50,500)

Ok, now lets go on to more use of the $nick identifier.

$nick(#,N)

Returns Nth nickname in the channels
nickname listbox on channel #.


$nick(#mirc,0)

will return the total number of nicknames
in the listbox on the #mirc channel.

12$nick(#mirc,1)

returns the 1st nickname in the #mirc nicklist.

Try this in the lab..

Type 12//say $nick(#script-lab,0)
Type 12//say $nick(#script-lab,1)
Type 12//say $nick(#script-lab,2)

Ok.. Using the $rand and $nick, lets
create a little script using these
two identifers.

We will build an alias, but first
lets look at the logic of this alias.

1.We set to %chan the channel.
2.We determine, how many nicknames are in the channel.
3.We set a random number between one and the total number of nicks
in the channel
4.Using the random number we set the nick of the person who matches
the random number in the nicklist.
5.We announce who the lucky nick is!

Here is the alias, please add this to your
clean remote, and let me know when your finished.

Alias F9 {
%chan $chan
set %n.total $nick(%chan,0)
set %ran $rand(1,%n.total)
set %nick $nick(%chan,%ran)
describe $chan bonks %nick with a baseball bat!
}


Now lets try this in the Lab.
in the lab (or other channel, hit your function key number 9 Smile

Ok.. lets write one more script
This will use two random nicks.

Note: with this alias, there is the
chance that your nick will be chosen
or that the same nick will be chosen
twice. Later you will learn how to
prevent this.

Note: the "$+" is used to connect two
items, with out one part interferreing
with the other part.

Alias F10 {
set %chan $chan
set %n.total $nick(%chan,0)
set %ran $rand(1,%n.total)
set %ran2 $rand(1,%n.total)
set %nick $nick(%chan,%ran)
set %nick2 $nick(%chan,%ran2)
msg $chan %nick was seen kissing %nick2 $+ !
}

Lets test this in a channel by pressing function key 10

Ok.. that is it for today.
We will see you next week.
If you have any questions
concerning todays material
this is the time to ask! Smile

http://www.mirc.org

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum