Jump to content

Use of raw events and dialogs.


Antics

Recommended Posts

Since I hadn't seen one, I figured I would write a tutorial for it.

 

 

Before reading this, even as simple as it is, you should make sure that you know how to work in remotes with the topics of dialogs and raw events.

 

Raw events are used on -every- IRC server.

Regulations require some (around 98% actually) of all raws to be stock. This includes /map, which shows a server 'map', such as all the servers linked to it. This information requested by using /map, and returns the tree with raw numeric 6, and ends with numeric 7.

One thing I cant stress enough, is make sure you use $dialog to verify that a dialog is open. Otherwise, you could end up with a very messy status window of errors.

 

 

This little snippet, which I just wrote for a friend, shows a server tree in a very simple dialog.

 

alias dmap { if (!$dialog(Map)) { dialog -m Map Map } }
dialog Map {
  title "Servers Map (Antics)"
  size -1 -1 182 189
  option pixels notheme
  list 1, 5 7 174 153
  button "Close", 2, 59 157 65 25
}
on *:DIALOG:Map:init:*:{ did -a Map 1 Beginning of /map | set -u5 %dialog.mapraws true | map }
on *:DIALOG:Map:sclick:2:{ if ($dialog(Map)) { dialog -x Map } }
raw 6:*:{ if ($dialog(Map)) && (%dialog.mapraws) { did -a Map 1 $2- } }
raw 7:*:{ if ($dialog(Map)) && (%dialog.mapraws) { did -a Map 1 End of /map } }

Now, if your wondering what all of this bundled code is, allow me to explain;

 

alias dmap { if (!$dialog(Map)) { dialog -m Map Map } }

Creates a very easy to remember alias, dmap (dialog map. Catchy huh?) for the end user, and checks to see if the dialog isnt already open.

 

Then we have our classic dialog creation process (as I stated, you should have already been working with dialogs before reading into this, so I'll just skip past it)

 

Next, we have our dialog events.

on *:DIALOG:Map:init:*:{ did -a Map 1 Beginning of /map | set -u5 %dialog.mapraws true | map }

This event triggers on the dialog "Map" being opened.

It prints "Beginning of /map" into the dialog, sets a variable which will be used later for error checking (unsets after 5 seconds), and finally calls /map.

on *:DIALOG:Map:sclick:2:{ if ($dialog(Map)) { dialog -x Map } }

This tells the dialog "Hey there, the ID 2 on dialog Map was single clicked. Lets close this dialog if its open."

 

Next, our raw events.

raw 6:*:{ if ($dialog(Map)) && (%dialog.mapraws) { did -a Map 1 $2- } }

raw 7:*:{ if ($dialog(Map)) && (%dialog.mapraws) { did -a Map 1 End of /map } }

As I have stated, MAKE SURE you use $dialog(dialogname) to verify the dialog is open.

These come into play when the /map command is called. They both check to see if the dialog is open ($dialog(Map)) and if the variable we set earlier is still active (%dialog.mapraws). If both meet to $true, then it prints the data into the dialog "Map" in ID 1.

Reason for using $2- instead of $1-, all raw events are triggered with $1 being your nickname.

As for raw 7, since its the end of the /map's tree, we print our own custom text into the dialog, "End of /map".

 

 

Dialogs can be used to do wonderful things with raw events.

Your own room lists, access dialogs, even a MOTD reviewer. They can also be used for debugging.

 

 

I leave you with this tip, if you ever need to find out which raws do what--

raw *:*:{ echo -s $numeric ::: $1- }

Before ::: will be your numeric, after, the text following.

 

 

I hope you have as much fun learning mIRC's multiple uses as I did, and if you ever need any help, you know where to find me. :)

Edited by Antics
Link to comment
Share on other sites

Guest X-Fusion
This is a good tutorial. This explains to new people on how to shut an active dialog if ones in use, among other things. Great tutorial Tony. B):yes: Edited by X-Fusion
Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...