JOhnson Posted March 18, 2009 Report Share Posted March 18, 2009 iv asked this question in rumbaars and I also got the code from rumbaars so im a little embarrassed to ask in here and im as it seems im not gettting anywhere and I feel like myself .. right the code his below on *:JOIN:*:{ .ctcpreply %targetnick TIME Welcome $nick hello The code is in remote as a .mrc ... iv then put this into variables %targetnick it gets better ... now this code works fine in spcn if the targetnick is a plain nick ... but hell if you try it with i.e ©Johnson© or even Johnson™ it wont work and to cap it all the code wont work with a plain or any other nick in koach or buzzen ... any advice or nudge or even a good prod in the right direction would be gratefully received Link to comment Share on other sites More sharing options...
Foreverurs Posted March 18, 2009 Report Share Posted March 18, 2009 shouldnt it be on *:JOIN:*:{ .ctcpreply $nick TIME Welcome $nick hello } ? Link to comment Share on other sites More sharing options...
Guest Travis Posted March 18, 2009 Report Share Posted March 18, 2009 JOhnson I see you use %targetnick, but I dont see you setting target nick. Regardless it is pointless to use a variable in an event to return $nick. Just use $nick. Link to comment Share on other sites More sharing options...
Guest X-Fusion Posted March 19, 2009 Report Share Posted March 19, 2009 Like I told you in the chat, your not setting the target nick... on *:JOIN:*:{ var %targetnick $nick .ctcpreply %targetnick TIME Welcome $nick hello } And even then, it's really a waste of code when you can do what Foreverurs and Travis posted. Link to comment Share on other sites More sharing options...
Fanfare Posted March 19, 2009 Report Share Posted March 19, 2009 (edited) No need to go the extra mile for variables in that piece of code. Edited March 19, 2009 by Fanfare Link to comment Share on other sites More sharing options...
JOhnson Posted March 19, 2009 Author Report Share Posted March 19, 2009 right fellas I am a bit confused here ... let me try and explain what im looking for say X-Fusion you come into my chatroom and I just want you to see a private message from me via my script as a ctcpreply surely Iv got to target your nick i.e %targetnick X-Fusion or everyone will see my message to you. Thank you for your replies and help and X my server went down while I was talking to you in the chatroom sz mate Link to comment Share on other sites More sharing options...
Guest X-Fusion Posted March 19, 2009 Report Share Posted March 19, 2009 No, you don't have to target it. That's what $nick does. $nick is the name your targeting in your event (in this case, an onjoin event). There's no need to set a variable for it. Link to comment Share on other sites More sharing options...
err0r Posted March 20, 2009 Report Share Posted March 20, 2009 it all depends on where it's placed as to what it will do.. if nick is in the target place as in ctcpreply $nick it will send to that nickname.. if you had ctcpreply $nick $nick hey it would target the nickname and say the nickname in the reply. This is the concept I tend to follow If i want to create a var for use only while the snippet is processing like a while loop then use a temp variable example to check what dialogs you currently have open /checkdialogs { var %d 1 while ($dialog(%d)) { echo -a $dialog(%d) inc %d } } now %d is a variable set, but it only lasts until the snippet is done processing. You do not have to use any unset. Once the process is over the var is gone. You can also use an unset command on a timer set -u5 %blah on This will set the variable %blah to on for a period of 5 seconds and then auto unset it. Reasoning behind using temp vars and timed unsets is to keep unneeded variables from accumulating in your variables file. Only set a non temp, non timed unset variable if you plan on using the variable for prolonged periods of time. I mainly use variables for settings or information I wish to keep for long periods of time. There are other methods such as hash tables and ini files that can do the same thing but I would first get comfortable with variables before i moved on to those other types. You won't have to set variables for things like $chan or $nick in an event unless you plan on carrying them over to something else. If the event supports the identifier you don't have to set a variable. for example on *:JOIN:#:{ set %nickname $nick set %channelname $chan ctcpreply %nickname Hey %nickname welcome to %channelname unset %nickname, %channelname } is more easily done with on *:JOIN:#:{ ctcpreply $nick Hey $nick welcome to $chan } The code doesn't work on buzzen because buzzen does not support ctcp like that so it would be a bit useless. Koach does have support for ctcp so you shouldn't have problems there Another thing to consider is on join commands like that, is to always add in flood protection. If you had a mass join on the room it would play havoc and most likely disconnect you without some form of flood protection. a simple auto unsetting variable would be a good idea. example on *:JOIN:#:{ inc -u3 %welcome.flood if (%welcome.flood == 1) && ($nick != $me) { ctcpreply $nick Hey $nick welcome to $chan } } Basically what it is doing is each time there is a join it sets an increasing number to the variable %welcome.flood Peter joins room %welcome.flood is set to 1 Jan joins room %welcome.flood is set to 2 and so on but the variable will unset after 3 seconds defined by the -u3 so it will start the count back over after 3 seconds so if more than 1 user joins in a 3 sec period it will not ctcpreply the nick :note the unset time can be lowered in a very active room As with most anything in scripting you can achieve the same thing in many different ways. I've laid out the previous examples in a way I hope is very easily understandable. If you have any questions just ask. Link to comment Share on other sites More sharing options...
JOhnson Posted March 22, 2009 Author Report Share Posted March 22, 2009 hell err0r what would we do without you fella ... iv read your reply and im over the moon with the way you have explained it lol iv not took it all in but most of it and I will keep reading it until I do ... I understand now that ctcpreply doesnt work in buzzen thats not a problem lol ... what can I say but as always err0r nais take = thank you Link to comment Share on other sites More sharing options...
err0r Posted March 22, 2009 Report Share Posted March 22, 2009 glad to help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now