mIRC Home    About    Download    Register    News    Help

Print Thread
Script Modification help #224380 09/08/10 04:52 PM
Joined: Apr 2010
Posts: 24
L
lassyakjedi Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2010
Posts: 24
i found a certain script which i like a lot smile
Code:
menu channel {
  reverse
  .on:/set %backwards on
  .off:/set %backwards off
}
on 1:INPUT:#test_bot: {
  if (%backwards == on ) {
    if ($1) {
      var %c $strip($1-),%a $len(%c)
      while %a >= 1 {
        var %b %b $+ $replace($mid(%c,%a,1),$chr(32),$str($chr(32),2))
        dec %a
      }
    }
    msg $active %b | halt
  }
}

Basically it reverses everything you say...
Is there anyway i could get it to work for someone else?
For example:
If i'm 'person x' on a channel
and i want to reverse every thing 'person y' says in the same channel.

Quote:

person y: Hello
person x: olleh

So the basic idea is my nick(person x) should reverse what ever 'person y' says on that channel(when the script is on that is) smile
Any way of modifying the script for this purpose?

Re: Script Modification help [Re: lassyakjedi] #224382 09/08/10 05:00 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Assuming your script works (haven't tested the actual reversing part of it), this should do what you want:

Code:
on ^*:text:*:#test_bot: {
  if (%backwards == on && $nick == PersonY) {
    var %c $strip($1-),%a $len(%c)
    while %a >= 1 {
      var %b %b $+ $replace($mid(%c,%a,1),$chr(32),$str($chr(32),2))
      dec %a
    }
  }
  echo -ambflt < $+ $nick $+ > %b | haltdef
}


Note that depending on how you have your <nick> format set up, you may also want to add the nick's mode (such as @) and the color of the nick in there.

Don't forget to change "PersonY" in the script to the nick you want this to work on. If you want it to work for everyone, remove that part of the IF check. If you have multiple people, you can make it work for more by changing the IF as well.

This also assumes you're using the same menu part of what you posted to set the backwards on/off. I didn't bother copying it into here since there wouldn't be a change.


Invision Support
#Invision on irc.irchighway.net
Re: Script Modification help [Re: Riamus2] #224384 09/08/10 05:32 PM
Joined: Apr 2010
Posts: 24
L
lassyakjedi Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2010
Posts: 24
@Riamus2
nope not following you,i can confirm that the script i pasted
earlier is working as i am currently using it.

but when i use your script (along with all the changes u mentioned) i get a different result.
Have a look. ( http://i976.photobucket.com/albums/ae245/lassyakjedi/test-bot.jpg )
It showes me a blank space when PersonY types anything.
The script is loaded into PersonX.
PersonX in the front and PersonY at the back in the pic.
PersonY had typed test,test1..but all personX could see were a few blank spaces.(Instead of seeing it in reverse/backwards)
I want it to read somthing like this
Quote:

<PersonY>: Test
<PersonX>: tseT
<PersonY>: Test1
<PersonX>: 1tseT

I thought due to the same white background im not able to see it..when i changed the background i got the same result

Last edited by lassyakjedi; 09/08/10 05:57 PM.
Re: Script Modification help [Re: lassyakjedi] #224386 09/08/10 06:32 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Hm. I can't test it right now at work because I can't connect to a network here, but if I change it to work as an alias instead of on text event, it is working fine, so it should work in the on text event as well.

Try putting this right above the echo line in the script:
Code:
  echo -a c = %c - b = %b


See what you have there. %c should be forward and %b should be backwards.

Is this the only on text event in this script file?


Invision Support
#Invision on irc.irchighway.net
Re: Script Modification help [Re: Riamus2] #224490 12/08/10 01:43 AM
Joined: Apr 2010
Posts: 24
L
lassyakjedi Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2010
Posts: 24
that helped,thanks

Re: Script Modification help [Re: lassyakjedi] #224491 12/08/10 01:56 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Sorry, I forgot about this. I just tested it and it works. There's just one change I'd make since I wasn't thinking correctly and was echoing to the active window instead of the target window...

Code:
on ^*:text:*:#test_bot: {
  if (%backwards == on && $nick == PersonY) {
    var %c $strip($1-),%a $len(%c)
    while %a >= 1 {
      var %b %b $+ $replace($mid(%c,%a,1),$chr(32),$str($chr(32),2))
      dec %a
    }
  }
  echo -mbflt $target < $+ $nick $+ > %b | haltdef
}


And, like I mentioned before, you might want to add mode prefixes on the nick if you normally display them and color for the nick if you normally show color on the nicks.

Otherwise, this is working just fine. If it's still not working, you may have something else conflicting with it.


Invision Support
#Invision on irc.irchighway.net
Re: Script Modification help [Re: lassyakjedi] #224495 12/08/10 04:41 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You can do this with $regsubex simply:
Code:
on ^*:text:*:#test_bot:{ 
  if (%backwards == on && $nick == PersonY) {
    echo -mbflt # $+(<,$nick(#,$nick).pnick,>) $&
      $regsubex($1-,/(.)/gS,$mid(\A,-\n,1))) | haltdef
  }
}