Skip to content
MSN Addons

script help

A TG007 community discussion started by Justeya.

Discussion 7 posts
Page 1 of 1
Open
Topic #4677 · 7 published posts · 2,072 views

Just wanting to know if there is a custom greeter code I can get for my msn group script...so that when my members come in they can set their own greetings for themselves.

 

Thanks in advance.

;Custom Greeter Code by The Gate Keeper
menu * {
 -
 Custom Greeter
 .$iif($readini(greeter.ini,settings,enabled),$style(2)) Turn On : writeini greeter.ini settings enabled $true
 .$iif(!$readini(greeter.ini,settings,enabled),$style(2)) Turn Off : remini greeter.ini settings enabled
 .-
 .Message to user when no greet is found
 ..View : echo -at Message : $readini(greeter.ini,settings,default)
 ..Change : writeini greeter.ini settings default $$?="Enter the new message you want to send to users. Note: !newgreet is how to change their greeting message"
 .Message Type
 ..$iif($readini(greeter.ini,settings,message) == onscreen),$style(2)) On Screen : writeini greeter.ini settings message onscreen
 ..$iif($readini(greeter.ini,settings,message) == onwhisper),$style(2)) On Screen Whisper : writeini greeter.ini settings message onwhisper
 ..$iif($readini(greeter.ini,settings,message) == time),$style(2)) Time Reply : writeini greeter.ini settings message time
 ..$iif($readini(greeter.ini,settings,message) == whisper),$style(2)) Whisper : writeini greeter.ini settings message whisper
}
on *:JOIN:#: {
 if (!$readini(greeter.ini,settings,enabled)) return
 var %g = $readini(greeter.ini,$right($chan,-1),$gettok($address,1,64))
 var %m = $replace($iif($readini(greeter.ini,settings,message),$ifmatch,time),onscreen,msg $chan,onwhisper,notice $nick,time,ctcpreply $nick TIME,whisper,msg $nick)
 if (%g) %m %g
 else {
   inc -u2 %gcount. [ $+ [ $right($chan,-1) ] ]
   if (%gcount. [ $+ [ $right($chan,-1) ] ] < 3) {
     %m $iif($readini(greeter.ini,settings,default),$ifmatch,Welcome $nick $+ , to set your own greet message just whisper me me or type in the main room - !newgreet <your new greet here>
   }
 }
}
on *:TEXT:*!newgreet*:#,?: {
 if (!$readini(greeter.ini,settings,enabled)) return
 if (!$2) msg $target You current greet is $readini(greeter.ini,$right($chan,-1),$gettok($ial($nick).addr,1,64))
 else { 
   writeini greeter.ini $right($chan,-1) $gettok($ial($nick).addr,1,64) $2-
   msg $target Your custom new greeting message has now been saved
 }
}

 

Try that, make sure you turn it on, set a default message, and set message type from the menu before allowing users to play with it. This is room based, meaning users can have different ones for different rooms.

Edited Sep 3, 2005 3:18 AM by The Gate Keeper

Since this is sorta the same thing....I been trying to get it working so that I can have my users add thier own profile link... any help with this I would be so gratious.

 

if ($3 = PUID) {

/sendtouser $sockname $roombotname PRIVMSG $groom2($sockname) :You can view my profile here <link>

 

Result after clicking on view profile option.

 

Bot: You can view my profile here www.myprofile.com/blah

Edited Aug 29, 2006 6:39 AM by Shagman

I think that's impossible..

To many sockets for me to even TRY and attempt. Heres a basic socket tutorial, so you can try yourself ..

About: This tutorial was written to give a basic idea to those new to mIRC sockets an idea of how the whole thing works. This tutorial utilizes most of the basic socket commands, as well as some custom aliases. Note: Your aliases do not have to be the same as mine, they're just for examples to make it easier to use and understand.

 

Step 1: This alias will open a socket to listen on port 1337.

alias opensocket {
  socklisten sock1 1337
  echo -a [sock] Socket successfully opened on $ip $+ : $+ $sock(sock1).port
}
Usage: /opensocket

Note: In order to be able to accept incoming socket connections, you must first open a listen socket, which is what we are doing with this alias. In order to receive information on a socket, we must first specify a socket name, and the port we would like mIRC to listen on. The port is required when making a socket connection

We now have a socket open on port 1337 by the name of sock1, it will be listening for any incoming connections from another client on that specific port. The following event is required in order to correctly establish the connection between you, and the person or program connecting to mIRC.

 

Step 2: This event is triggered when a connection is incoming, you must accept the connection using sockaccept to complete it.

on *:socklisten:sock1: {
  sockaccept sock2
  echo -a [sock] Incoming socket connection accepted!
}
Format: on *:socklisten:sockname: { sockaccept <socket name> }

Note: The new socket name must differ from the current name of the listen socket. In this example, we used "sock2" as the new socket name. The sockname in the event is the name of the listen socket we first opened using the /opensocket alias I wrote.

 

Step 3: This event will read any incoming data on the newly opened connection.

on *:sockread:sock2: {
  sockread %sock.data
  echo -a [sock] Incoming Data: %sock.data
}
Format: on *:sockread:sockname: { sockread %variable }

Note: The sockname in the event is the name of the newly opened connection, not the listen socket. Because we assigned the new connection the name of "sock2", we use that name in the sockread event. In order to grab the incoming data, you must use the /sockread command. As shown above, the sockread command is writing all of the incoming data to a variable I created called %sock.data (You can use whatever you want as your variable name). I then echo'd the data to the active window using echo -a.

 

Step 4: This alias will attempt to connect to your newly opened socket.

alias connsocket { sockopen sock3 $ip 1337 }

Usage: /connsocket

Format: sockopen <name> <ip> <port>

 

Step 5: This alias will write info to the newly created sock3 connection made with the alias above.

Note: Normally this procedure is done on a separate client, but for the purpose of this tutorial, we'll only use this one client.

Now that we have the connection accepted and established, we can now send information to the socket. In order to do that, you must use the /sockwrite command.

The syntax for that command is as follows:

/sockwrite -n <sockname> <data>

Note: The -n param automatically adds a $crlf to the end of any outgoing data. (not required)

alias writesock { sockwrite -n sock3 $1- }

Usage: /writesock <data>
Example: /writesock How are you doing socket??!?!

 

Step 6: Close the sockets once you're through with them using the following alias.

alias closesocks {
  sockclose sock*
  echo -a [sock] All sockets matching sock* have been closed!
}

This alias will close all of the open sockets matching that wildcard criteria, since our socket names were: sock1, sock2, and sock3, using sockclose sock*, would close all of them at once. Make sense?

I see... almost looks like its coding for comumication with the server...does it work the same if you include the same type of coding in the actual server, as that is what i am trying to do?

Edited Aug 30, 2006 11:15 AM by Shagman

HI X-Fusion

I would like to know how to make a $Cid socket

Thanks