Skip to content
General Chat Talk

Code

A TG007 community discussion started by Johnson.

Discussion 11 posts
Page 1 of 1
Open
Topic #9759 · 11 published posts · 2,431 views

:oops: can anyone help me with this .. as you know im still new to codes in scripts .. but i do try and this is one of them times im trying but not getting anywhere .. i want this to come into the room but it wont .. so i need help. Please if you correct this code and get it to work .. if possible would you explain to me where i went WRONG

 

On*:Join:*:{
  if ($nick == $me) 
  msg # S eTahoma;0 blah blah blah

Hello,

space between on and star and # for chan

on *:join:#: { if ($nick == $me) { msg # blah } }

but if you want to send the message for any user come in room you should remove the if ($nick == $me)

here in your code it will sent only when your script joins the room.

should be shorter if you do :

on me:*:join:#:msg # blah

Now, if you want to send the message when someone join room but not when your script join it you can do :

;! == if ($nick != $me)
on !*:join:#:msg # blah

 

i hope it should help you.

Edited Feb 28, 2008 10:34 AM by Orus

:lmaojump: Orus Thankyou for your reply and for explain it to me .. to many barckets { in my code lol when i clicked on brackets {} in mirc it didnt tell me there was anything wrong so i left them in lol im using this and it works perfect. Again thankyou for your help :D

 

 on !*:join:#:msg # blah

in your code, you forgot the ending bracket }

 

When you open one, you must close it.

 

C ya

Id have to suggest that if you aren't going to use brackets (which you should) that you keep your commands on the same line as your if comparisons.

Id have to suggest that if you aren't going to use brackets (which you should) that you keep your commands on the same line as your if comparisons.

 

 

:lolwave: Travis ... you know im open to offers .. do it and i will compare it to mine :D and also it helps me to understand things as you know i have reading a learning difficultys :( but GOD loves a tryer .. and you can be assured im one of them :D

Whenever you open a bracket, you MUST close that bracket at some point in your statement. I'll use your code to give you an example.

on *:JOIN:#:{ 
;That was your first bracket (the {). Now, at some point, you'll have to close that bracket. This will come later.
  if ($nick == $me) { 
;This determines whether or not the nickname is you. Notice, I opened another bracket.
  halt
}
;Notice how I closed the bracket AFTER I issued my statment. Thsi bracket close the if ($nick == $me) bracket
  else { 
;Opening another bracket
  msg # S eTahoma;0 blah blah blah
}
;Closing said bracket after I opened it.
}
The final bracket the closes the statement all together. This bracket comes from my on *:JOIN:.

So, after all that is said and done, you have a code that looks like

on *:JOIN:#:{ 
  if ($nick == $me) { 
  halt
}
  else { 
  msg # S eTahoma;0 blah blah blah
}
}

That's simple enough, right?

:lmaojump: ... X-Fusion .. Thankyou Very Much For That ... I do understand it and i will keep that for future reference .. it is very well explained. Thankyou Again :D .. :oops: Travis :lolwave: Your To Late :D
Travis ... you know im open to offers .. do it and i will compare it to mine

 

On*:Join:*:{

if ($nick == $me)

msg # S eTahoma;0 blah blah blah

 

You've already been told about the space after the word "on".

 

In any event it states the location. on *:join:LOCATION:{

 

ex: on *:join:#:{ <<< # == $chan or channel name.

 

You chose a wildcard *, but in a join event why? What else are they going to join besides a channel (#) ?

 

As for what I had said earlier there are a few points I'd like to make. It is my understanding that mIRC evaluates code line by line one at a time. So looking at this code you have presented I would say mIRC evaluates "if ($nick == $me)" and lets say it is $true so it looks for the command but doesn't see anything so it goes on to the next line which is a command to msg the channel.

 

So looking at your code Im not sure if you left out the /halt or /return command, or if you wanted mIRC to msg the channel if YOU join the room. mIRC will evaluate the comparison and if it is true it will not see a command for it. Then it will move to the next line and since there is no comparison it will just perform the command. So this code you presented will msg the room whenever anyone joins.

 

mIRC likes brackets. People get lazy and say "oh but I don't need them, see? It still works!" While this may be true, mIRC performs more efficiently and actually faster if you use brackets. I've tested this. This is why if you look through my scripting you will see I always use brackets. Later it was explained to me on the mIRC.com forum that if there is no bracket mIRC looks ahead and attempts to figure out where your line ends. If you use brackets it doesn't need to spend the time and resources figuring this out. This is why I always suggest using brackets. Get in the habit of it, even if it is one small command or simply { return }. Not only will it make you more used to writing in brackets but every little bit helps. So yeah, one line of not using a bracket is no big deal, but 3000 lines of no brackets add up.

 

So lets assume you wanted to only message the room when YOU joined.

 

on *:join:#:{

if ($nick == $me) { msg $chan blah blah blah }

}

 

Since you use brackets you could put the command on the next line if you wanted, though it is fastest to have everything on one line. AS LONG AS YOU AREN'T OVERDOING IT!

 

If you used brackets your code would still work.

 

on *:join:#:{
  if ($nick == $me) {
    msg $chan blah blah blah
  }
}

 

Since you didnt use brackets and put the command on the second line mIRC figured your comaprison was missing its command, called it an error on your part and moved on to evaluate the next line.

 

 

As an added note:

 

Not wanting to fry your brain or anything, but I personally would use a prefix for this. Prefixes are great as they can halt an event before mIRC runs through the first comparison.

 

on me:*:join:#:msg $chaN BLAH BLAH BLAH

 

Check out "prefixes" in the mirc help file.

:lmaojump: ... Ok Travis .. dont be offended in what i say .. i appreciate your help but has iv sed before i have reading and leaning difficultys .. im what they call in the uk (dont know if its the same in usa) im a hands on fella .. what you put is very hard for me to take in and understand .. now on the other hand what X-Fusion showed me was a lot simpler for ME to understand but as iv sed to him i will say to you thankyou for your time and effort to try and explain to me the coding. :D

Well sure, he simply talked about closing any tags, or brackets, you open. I talked about a bit more. But really, if you have any questions just ask! :)

 

We teach our brains how to think and process information. There is never a point where it is too late. An old man can have a stroke and re-teach himself how to do things as simple as zip his pants or as difficult as calculations and the english language. Your only limit is what you put on yourself, so do not limit yourself.

 

I used to have a terrible memory until I got sick of it and started consciously trying to remember. I kept at it and after a few years I found myself unconciously remembering things like 11 digit passwords a year after I used them. Of course it isn't so cut and dry but I urge you to never limit yourself to any infirmary. Look at the people who were told they would never walk again and didn't give up. We are constantly evolving organisms that really have no limits other than what we put on ourselves. Good luck to you Lynx. :)