mIRC Homepage
Posted By: eendje Addons, scripting and all stuff around it;x - 27/04/03 02:26 PM
Hello,
Well, I'm Using IRC for about 1/2 year now, And I decided to make some addons, and maybe a whole new script with these addons.
I've been scripting a lot lately and some of my scripts even work.
But Still I meet some porblems, I got multiple little scripts here that I got problems With And I Need some help to solve them, and I got some Non scripting problems, With adding sub menus to the script and stuff, But hopefully this will all clear up in the coming questions, There will also be some images inserted to make some things clear and stuff
Well here we go:

First up:
I've made a little script what should say "I rule XXX peons in XXX channels!" When u write //say $power, And it doesn't work, It just replys a number like 177

u can see a little screenie here what happens
http://members.lycos.nl/bibadi/power.jpg
As you see when i say //say $power you see a number.
But I want the line I rule %j damned crypts (of $chan(0) $+ ) and possess %k cursed souls (of %l $+ ).

This is my code
Code:
  
alias power {
  var %i = 1,%j,%k,%l 
  while ($chan(%i)) {
    if ($me isop $chan(%i)) {
      set %k $calc(%k + $nick($chan(%i),0)) 
      inc %j 
    } 
    set %l $calc(%l + $nick($chan(%i),0)) 
    inc %i 
  } 
  return I rule %j damned crypts (of $chan(0) $+ ) and possess %k cursed souls (of %l $+ ).
}


Then I got another problem;
I made another little script;

Code:
 on *:ACTION:$(* $+ $me $+ *):*: {if (!%action. [ $+ [ $address($nick,2) ] ]) { /describe $target $replace($1-,$me,$nick)}
 


This should, when some1 slaps me, Slap him back with excactly the same line But only his name instead of mine, And sometimes it works and sometimes it doesn't
(practically it must say the same thing as another does when he write a line starting with /me and where my nick is placed in , But he doesn't do that always.

Then I made some slapper script, But i practically don't know how to make a sub menu, (when i click right mouse in a chan) Where i can see it and use them;x
Also for this i have a screenie
Which is located here;
http://members.lycos.nl/bibadi/slaps.gif
As you see I already got some slaps there but they are from the script I use now,
Now I want A New submenu, under the submenu 'slaps' called 'slaps2' (smart heh) Where i can put my own slaps. And offcourse I want it to be there when I put a file In my IRC map;x (so i will not change my remote) (it's an addon).

And I made a script when someone bans me, I should remove the ban, Deop the 1 who did it, and notice myself that I was banned
Code:
on !@*:ban:#:{
if ($banmask iswm $address($me,5)) {
  mode $chan -bo $banmask $nick
  echo -a [ ban ] $nick banned you ( $+ $banmask $+ ) on $chan
}

But I woudn't come here if it didn't work:D
Well, I think That's about it for now,
I hope that someone can solve all my problems, Or atleast 1:)


( By The way: Mind my english;x I'm dutch;x)
Okay first off, I have no problems with echo or saying $power.. i.e.



Secondly, the action text is a little sloppy.. I copy and pasted exactly, and the editor shoved everything below it over. All i did was space out your braces, making sure they don't touch anything, and it seems to work fine.

Code:
on *:ACTION:$(* $+ $me $+ *):*: { if (!%action. [ $+ [ $address($nick,2) ] ]) { /describe $target $replace($1-,$me,$nick) } }


or to be even neater (in my opinion), use..

Code:
on *:ACTION:$(* $+ $me $+ *):*: {
  if (!%action. [ $+ [ $address($nick,2) ] ]) {
    /describe $target $replace($1-,$me,$nick)
  }
}



Thirdly, as for the ban script. From off hand, just an immidate look without further testing, I noticed a missing brace. I believe, you should be able to add a brace to the end, and everything should be fine.

Code:
on !@*:ban:#:{
  if ($banmask iswm $address($me,5)) {
    mode $chan -bo $banmask $nick
    echo -a [ ban ] $nick banned you ( $+ $banmask $+ ) on $chan
  }
[color:Red]}[/color]


If there is anything, just let me know. grin
You might want to change that on action a little
Code:
on *:ACTION:$($+(*,$me,*)):*:{
  if !%action. [ $+ [ $site ] ] {
    ; Check if $target is a channel or <You>
    if $target ischan { describe $target $replace($1-,$me,$nick) }
    else { describe $nick $replace($1-,$me,$nick) }
  }
  ; Prevent slapping frenzies if user had some similar script.
  inc -u30 %action. $+ $site
}
Add your popups by putting them into a new script file (Alt+A > File menu > New)
Code:
menu nicklist,query {
 .Slaps2
 ..one:echo -a your slap #1 goes here
 ..two:echo -a your slap #2 goes here
 ..three:echo -a your slap #3 goes here
}
wel, yes there is a problem
//echo $power | /say $power
Then my script says
* /echo: insufficient parameters
Thats strange. What version of mirc are you running? I have 6.03 and the double execute works perfectly fine.. If you want to try it stil, just revise it so that $power is not the only thing being displayed. Ex:

//echo Power: $power | /say Power: $power

That will work, I'm pretty confidant. grin
most likely because of power script writting ....... or poor usage of an alias identifer uve made ...... or, $power isnt an identifier in mirc that i have seen. if u try using an identifier that doesnt exist of course there is going to be an error
also king keep in mind to use an identifier u ned to use //say instead of /say
Posted By: RoCk Re: Addons, scripting and all stuff around it;x - 28/04/03 02:38 PM
He took care of the // at the beginning of the line .. and actually, the SAY didn't need a slash at all.
That is correct. If you prefic the first statement with double slashes, everything after it, including after a pipe, can be treated like it's in remotes. grin
Type //echo -a $isalias(power) : $isalias(power).fname
Check the filename is the same as the one for this script, you may have another 'power' alias which requires some parameters.
Well, I just changed the alias from $power to $power2 and it worked;x
Good :[/b])
Hi im new to scripting, dunno much about it actually, but I want to learn. How would I set a counter slap that would say something like:
<Example> Example slaps jejeje with a large trout
<jejeje>counter Example's slap with a rusty old bucket
on 1:ACTION:$(*slap* $+ $me $+ *):#: {
/describe $chan slaps $nick with a rusty old bucket.
}
I meant something other than slap. The script works btw, but what do I insert to make the countering code other than slap.
i.e. rather than slap, there's punch, poke, spit, etc.
this is what i use:

Code:
[color:green]
; -------------------------------------------------------------------------------------------------
; Anti-Action
[/color]
on 1:ACTION:$(* $+ $me $+ *):#: {
  var %a = 1, %keys = [color:red]slap smack trout shoot hit oozy gun[/color]
  while (%a &lt;= $numtok(%keys, 32)) {
    if (($gettok(%keys, %a, 32) isin $1-) &amp;&amp; ($me isop $chan)) {
      /inc -u5 %slap. [ $+ [ $nick ] ]
      if (%slap. [ $+ [ $nick ] ] &lt; 3) /describe $chan [color:Red]slaps $nick with an old rusty bucket.[/color]
      return
    }
    /inc %a
  }
}


The first red portion is the "triggers" i.e. youd add poke, spit, punch, etc. The second is the responce made back at the user.
thank you so much =D
np glad to help >:D
© mIRC Discussion Forums