mIRC Homepage
Posted By: shy_and_quiet simple On TEXT script - 19/08/03 08:20 PM
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!

Posted By: FunChatter Re: simple On TEXT script - 19/08/03 08:45 PM
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
Posted By: shy_and_quiet Re: simple On TEXT script - 19/08/03 08:53 PM
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?
Posted By: FunChatter Re: simple On TEXT script - 19/08/03 09:22 PM
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
Posted By: shy_and_quiet Re: simple On TEXT script - 19/08/03 09:31 PM
*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 $+ ?
Posted By: FunChatter Re: simple On TEXT script - 19/08/03 09:43 PM
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!.
Posted By: shy_and_quiet Re: simple On TEXT script - 19/08/03 09:51 PM
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!!
Posted By: Hammer Re: simple On TEXT script - 19/08/03 10:25 PM
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.
© mIRC Discussion Forums