Jump to content

Code


Guest Johnson

Recommended Posts

: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

Link to comment
Share on other sites

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 by Orus
Link to comment
Share on other sites

: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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest X-Fusion

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?

Link to comment
Share on other sites

: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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

: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
Link to comment
Share on other sites

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...