mIRC Home    About    Download    Register    News    Help

Print Thread
simple On TEXT script #43028 19/08/03 08:20 PM
Joined: Aug 2003
Posts: 27
S
shy_and_quiet Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2003
Posts: 27
Could someone help me with this simple script? I know it is probably a simple thing, but I'm still very much just learning, and would appreciate you help.

I'm trying to make a script that will work like this:
1. shy_and_quiet: pray for judy guardian
guardian: this is a prayer for judy

2. shy_and_quiet: pray for sue guardian
guardian: this is a prayer for sue

3. shy_and_quiet: will you pray for beth guardian
guardian: this is a prayer for beth

I hope you get what I mean. Here is the script that I have tried:

on 1:TEXT:*pray for* *guardian*:#Free_Women:{ msg $chan this is prayer for $3 }

That doesn't work quite right, and I know that it is flawed...but I don't know how to fix it and make it work right.

Does anyone have any suggestions? Basically, I want it to catch the name being ask to be prayed for, and have it return that name in the prayer.

Thank you!



~~~

I'm a Scripting Newbie, please forgive my questions, and have patience with me. Thanks!
Re: simple On TEXT script #43029 19/08/03 08:45 PM
Joined: Dec 2002
Posts: 339
F
FunChatter Offline
Fjord artisan
Offline
Fjord artisan
F
Joined: Dec 2002
Posts: 339
The only problem I could think of with your code would be the ...EXT:*pray for* *guardian*:#Free... should be *pray for*guardian* not sure thought... so your code should be

Code:
on 1:TEXT:*pray for*guardian*:#Free_Women:{ msg $chan this is prayer for $3 }



But if I scripted this for myself I would use...

Code:
on *:TEXT:*:#Free_Women:{ if (pray == $1 && for == $2 && guardian == $4) { msg # This prayer is for $3 $+ . } }


of course there million other ways of scripting it such as

Code:
on *:TEXT:*:#Free_Women:{ if (pray == $1) && (for == $2) && (guardian == $4) { msg # This prayer is for $3 $+ . } }


or many others laugh

Re: simple On TEXT script #43030 19/08/03 08:53 PM
Joined: Aug 2003
Posts: 27
S
shy_and_quiet Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2003
Posts: 27
Thank you FunChatter

I have put in the script that you wrote, and it works well for "pray for judy guardian" and gives the right response. But if I write "can you pray for judy guardian" it gives no response. Do you know why that might be, or what I can do to get it to respond properly if it is asked that way?


~~~

I'm a Scripting Newbie, please forgive my questions, and have patience with me. Thanks!
Re: simple On TEXT script #43031 19/08/03 09:22 PM
Joined: Dec 2002
Posts: 339
F
FunChatter Offline
Fjord artisan
Offline
Fjord artisan
F
Joined: Dec 2002
Posts: 339
We could add if (pray for isin $1-) but then we would have no way of knowning if the nick is $3 $4... or $N...
We could add a line for can you pray for x guardian though...

Code:
on *:TEXT:*:#Free_Women:{ 
if (pray == $1 && for == $2 && guardian == $4) { msg # This prayer is for $3 $+ . } 
if (can == $1 && you == $2 && pray == $3 && for == $4 && guardian == $6) { msg # This prayer is for $4 $+ . } 
}


so now we got a line witch detected *pray for x guardian* and one who detects *can you pray for x guardian* laugh

Re: simple On TEXT script #43032 19/08/03 09:31 PM
Joined: Aug 2003
Posts: 27
S
shy_and_quiet Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2003
Posts: 27
*smiles* Thank you FunChatter!!

In the second line of script though, should the very last variable be { msg # This prayer is for $5 $+ . } ? 5 instead of $4?

So, I should write an If line for each way that I think they might ask? Like one for just "pray for x guardian" and one for "can you pray for x guardian" and another for "will you pray for x guardian"?

*smiles* I'm excited to have learned how to do something new!! hehehe!!

btw - i understand everything in that code, except what $+ means at the very end of each response line. What is $+ ?


~~~

I'm a Scripting Newbie, please forgive my questions, and have patience with me. Thanks!
Re: simple On TEXT script #43033 19/08/03 09:43 PM
Joined: Dec 2002
Posts: 339
F
FunChatter Offline
Fjord artisan
Offline
Fjord artisan
F
Joined: Dec 2002
Posts: 339
You are right, the $4 was a typical mistake, $5 is the correct one...

In identifyers and generaly you can't just stick up $nick and a dot coz it will apear as a $nick. identifyer witch dosn't exit... same for $5 $4 $3... $whatever so you need to use $+ to stick up an identifyer with something else laugh

Here is what the mIRC help file says:


Quote:
/silly /say Hel $+ lo th $+ ere $+ !

Parameters are normally separated by a space. To make mIRC combine parameters you can use the $+ identifier. The above line will say Hello there!.

Re: simple On TEXT script #43034 19/08/03 09:51 PM
Joined: Aug 2003
Posts: 27
S
shy_and_quiet Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2003
Posts: 27
YIPEEE!! It Works great!! Thank you so much!! Now I have a working script for that, AND I have learned a little more about scripting!!

Despite all the questions I've been asking over the past few days, I really am learning. There is just so much to learn, that it is coming slowly but surely!!

Thank you FunChatter for your patience with my questions, and for teaching me a little bit more about scripting. VERY much appreciated!!


~~~

I'm a Scripting Newbie, please forgive my questions, and have patience with me. Thanks!
Re: simple On TEXT script #43035 19/08/03 10:25 PM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:

on *:TEXT:*pray for & guardian:#:{
  .msg $Nick Ok! Picture me praying for $gettok($1-, -2, 32) $+ .
}

<+YourNick> Ok, like can you like PLEASE pray for Hammer guardian
<[color:600080]@Guardian[/color]> Ok! Picture me praying for Hammer.
Code:

on *:TEXT:*pray for * guardian*:#:{
  if $regex($1-, /pray for (.+) guardian/i) { 
    .msg $chan Ok! picture me praying for $regml(1) $+ . 
  }
}

<+YourNick> Oh no! Mom just called. Can you please pray for Hammer, ParaBrat and d00dman Guardian?? I'd really appreciate it.
<@Guardian> Ok! Picture me praying for Hammer, ParaBrat and d00dman.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C