mIRC Home    About    Download    Register    News    Help

Print Thread
#210216 08/03/09 07:22 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
hi all.

I have this slap manager it works pretty well but ......

In the code of the slap manager all info like $chan, $me, $nick, etc, etc are variables because of the dialog.
So if i download a file with slaps or copy one i see in a room i have to remake the slap using %chan for $chan and %nick for $1 etc, etc.

As u can see at if ($did == 3) and if ($did == 2)there are a lot of variables.
Code:
var %nick = $did(7).seltext
that is the nick that should get the slap($1 in a normal slap)

Code:
var %chan = $did(8)
that is the channel that should get the slap($chan in a normal slap)

these were examples of some variables.
Is there a way to change the code so the slaps can stay original?
here is the code of the script:
Code:
alias naam {
  var %r = $lines(%tb)
  var %i = 1
  while (%i <= %r ) {
    did -a slap 1 $deltok($read(%tb,%i),2-,124)
    inc %i
  }
}


alias preview { 
  var %ik = $me
  var %nick = $did(7).seltext
  var %sound = sound $did(8)
  var %text = $gettok($read(%tb,t, $did(slap,1).sel),2-,124)
  if ($window(@preview)) window -c @preview
  window -bfk0l @preview 593 480 1060 140
  tokenize 124 %text
  aline @preview $*
} 

on *:dialog:slap:*:*:{
  if (!$istok(mouse edit,$devent,32) && $did != 3 && $active != @slap.preview && $window(@slap.preview)) { window -c $ifmatch }
  if ($devent == init) {
    .echo -q $dialog($dname).hwnd
    .echo -q $ttdll(Mark,$dialog($dname).hwnd)

    ;Chatkamers
    .echo -q $ttdll(ToolTip,$dialog($dname).hwnd > 8 balloon)
    .echo -q $ttdll(SetText,$dialog($dname).hwnd > 8 $_(pmtp00))
    .echo -q $ttdll(SetTitle,$dialog($dname).hwnd > 8 1 $_(pmtp01))
    .echo -q $ttdll(SetTxtColor,$dialog($dname).hwnd > 8 $rgb(0,0,0))
    .echo -q $ttdll(SetBkgColor,$dialog($dname).hwnd > 8 $rgb(255,255,225))

    ;blok alle beichten
    .echo -q $ttdll(ToolTip,$dialog($dname).hwnd > 7 balloon)
    .echo -q $ttdll(SetText,$dialog($dname).hwnd > 7 $_(pmtp02))
    .echo -q $ttdll(SetTitle,$dialog($dname).hwnd > 7 1 $_(pmtp03))
    .echo -q $ttdll(SetTxtColor,$dialog($dname).hwnd > 7 $rgb(0,0,0))
    .echo -q $ttdll(SetBkgColor,$dialog($dname).hwnd > 7 $rgb(255,255,225))

    ;blok alle beichten
    .echo -q $ttdll(ToolTip,$dialog($dname).hwnd > 10 balloon)
    .echo -q $ttdll(SetText,$dialog($dname).hwnd > 10 $_(pmtp04))
    .echo -q $ttdll(SetTitle,$dialog($dname).hwnd > 10 1 $_(pmtp05))
    .echo -q $ttdll(SetTxtColor,$dialog($dname).hwnd > 10 $rgb(0,0,0))
    .echo -q $ttdll(SetBkgColor,$dialog($dname).hwnd > 10 $rgb(255,255,225))

    ;willekeurige popup
    .echo -q $ttdll(ToolTip,$dialog($dname).hwnd > 2 balloon)
    .echo -q $ttdll(SetText,$dialog($dname).hwnd > 2 $_(pmtp06))
    .echo -q $ttdll(SetTitle,$dialog($dname).hwnd > 2 1 $_(pmtp07))
    .echo -q $ttdll(SetTxtColor,$dialog($dname).hwnd > 2 $rgb(0,0,0))
    .echo -q $ttdll(SetBkgColor,$dialog($dname).hwnd > 2 $rgb(255,255,225))

    ;gekozen popup
    .echo -q $ttdll(ToolTip,$dialog($dname).hwnd > 3 balloon)
    .echo -q $ttdll(SetText,$dialog($dname).hwnd > 3 $_(pmtp08))
    .echo -q $ttdll(SetTitle,$dialog($dname).hwnd > 3 1 $_(pmtp09))
    .echo -q $ttdll(SetTxtColor,$dialog($dname).hwnd > 3 $rgb(0,0,0))
    .echo -q $ttdll(SetBkgColor,$dialog($dname).hwnd > 3 $rgb(255,255,225))

    ;popup toevoegen
    .echo -q $ttdll(ToolTip,$dialog($dname).hwnd > 5 balloon)
    .echo -q $ttdll(SetText,$dialog($dname).hwnd > 5 $_(pmtp10))
    .echo -q $ttdll(SetTitle,$dialog($dname).hwnd > 5 1 $_(pmtp11))
    .echo -q $ttdll(SetTxtColor,$dialog($dname).hwnd > 5 $rgb(0,0,0))
    .echo -q $ttdll(SetBkgColor,$dialog($dname).hwnd > 5 $rgb(255,255,225))

    ;popup verwijderen
    .echo -q $ttdll(ToolTip,$dialog($dname).hwnd > 4 balloon)
    .echo -q $ttdll(SetText,$dialog($dname).hwnd > 4 $_(pmtp12))
    .echo -q $ttdll(SetTitle,$dialog($dname).hwnd > 4 1 $_(pmtp13))
    .echo -q $ttdll(SetTxtColor,$dialog($dname).hwnd > 4 $rgb(0,0,0))
    .echo -q $ttdll(SetBkgColor,$dialog($dname).hwnd > 4 $rgb(255,255,225))


    mdx SetMircVersion $version
    mdx MarkDialog $dname $dialog($dname).hwnd
    mdx SetControlMDX $dname 10 TreeView haslines linesatroot hasbuttons showsel > $views
    did -i $dname 10 1 setcolor text $color(5)
    did -i $dname 10 1 setcolor bkg $color(15)
    did -i $dname 10 1 setcolor line $color(6)
    did -a $dname 10 $_(pm01)
    did -a $dname 10 $_(pm02)
    did -a $dname 10 $_(pm03)
    did -a $dname 10 $_(pm04)
    did -a $dname 10 $_(pm05)
    did -a $dname 10 $_(pm06)
    did -a $dname 10 $_(pm07)
    did -a $dname 10 $_(pm08)
    did -a $dname 10 $_(pm09)
    did -a $dname 10 $_(pm10)
    did -i $dname 10 1 cb last
    did -a $dname 10 $_(pm11)
    did -a $dname 10 $_(pm12)
    did -a $dname 10 $_(pm13)
    did -a $dname 10 $_(pm14)
    did -a $dname 10 $_(pm15)
    did -a $dname 10 $_(pm16)
    did -a $dname 10 $_(pm17)
    did -a $dname 10 $_(pm18)
    did -i $dname 10 1 cb up
    did -a $dname 10 $_(pm19)
    did -i $dname 10 1 cb last
    did -a $dname 10 $_(pm20)
    did -a $dname 10 $_(pm21)
    did -a $dname 10 $_(pm22)
    did -a $dname 10 $_(pm23)
    did -i $dname 10 1 cb up
    did -a $dname 10 $_(pm24)
    did -i $dname 10 1 cb last
    did -a $dname 10 $_(pm25)
    did -a $dname 10 $_(pm26)
    did -i $dname 10 1 cb up
    did -a $dname 10 $_(pm27)
    did -a $dname 10 $_(pm28)
    did -i $dname 10 1 cb last
    did -a $dname 10 $_(pm29)
    did -a $dname 10 $_(pm30)
    did -a $dname 10 $_(pm31)
    did -a $dname 10 $_(pm32)
    did -a $dname 10 $_(pm33)
    did -i $dname 10 1 cb up
    did -a $dname 10 $_(pm34)
    did -i $dname 10 1 cb last
    did -a $dname 10 $_(pm35)
    did -a $dname 10 $_(pm36)
    did -a $dname 10 $_(pm37)
    did -a $dname 10 $_(pm38)
    did -i $dname 10 1 cd root
    did -r slap 1 
    loadbuf -o slap 1 $mircdirdata\popup\slap.txt
    var %schan = $chan(0) | while (%schan > 0) { did -a slap 8 $chan(%schan) | if ( $chan(%schan) == $active ) { did -c slap 8 $did(8).lines } | dec %schan
    }
    var %snicks $nick($active,0)
    while (%snicks > 0) {
      did -a slap 7 $nick($active, %snicks)
      dec %snicks
    }
  }
  if ($devent == sclick) {
    if ($did == 1) {
      if ($did(1).seltext) {
        preview
      }
    }
    if ($did == 8) {
      var %schan $did(8) 
      did -r slap 7 
      var %snicks $nick($did(8),0)
      while (%snicks > 0) {
        did -a slap 7 $nick($did(8), %snicks)
        dec %snicks
      }
    }
    if ($did == 5) {
      write %tb $?= $_(pm39) 
      did -r slap 1 
      loadbuf -o slap 1 %tb | did -r slap 1 | naam
    }
    if ($did == 4) {
      write -dl $+ $did(1).sel %tb
      did -r slap 1 
      loadbuf -o slap 1 %tb | did -r slap 1 | naam
    }
    if ($did == 3) {
      var %snicks $nick($active,0)
      while (%snicks > 0) {
        set %nlist $nick($active, %snicks)
        dec %snicks
      }
      var %ik = $me
      var %nick = $did(7).seltext
      var %msg = msg $did(8)
      var %act = describe $did(8)
      var %sound = sound $did(8)
      var %chan = $did(8)
      $gettok($read(%tb,pt, $did(1).sel),2-,124)
      window -c @preview
    }
    if ($did == 2) {
      var %ik = $me
      var %nick = $did(7).seltext
      var %msg = msg $did(8)
      var %act = describe $did(8)
      var %sound = sound $did(8)
      var %chan = $did(8)
      var %nlist = $did(7)
      $gettok($read(%tb,pt),2-,124) 
    }
    if ($did == 10) {
      tokenize 32 $did($did,1) 
      if ($1 == slclick) {
        if ($4 == 2) { set %tb %popuppath $+ \knuffel.txt | did -r slap 1 | naam }
        if ($4 == 3) { set %tb %popuppath $+ \zoenen.txt | did -r slap 1 | naam }
        if ($4 == 4) { set %tb %popuppath $+ \bedankt.txt | did -r slap 1 | naam }
        if ($4 == 5) { set %tb %popuppath $+ \sorry.txt | did -r slap 1 | naam }
        if ($4 == 6) { set %tb %popuppath $+ \plaatjes.txt | did -r slap 1 | naam }
        if ($4 == 7) { set %tb %popuppath $+ \smiley.txt | did -r slap 1 | naam }
        if ($4 == 8) { set %tb %popuppath $+ \vlaggen.txt | did -r slap 1 | naam }
        if ($4 == 9) { set %tb %popuppath $+ \gezichten.txt | did -r slap 1 | naam }
        if ($4 == 10) { set %tb %popuppath $+ \nepmodes.txt | did -r slap 1 | naam } 
        if ($4 == 11) { set %tb %popuppath $+ \gelegenheden.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 2) { set %tb %popuppath $+ \verjaardag.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 3) { set %tb %popuppath $+ \trouwen.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 4) { set %tb %popuppath $+ \jubileum.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 5) { set %tb %popuppath $+ \geboorte.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 6) { set %tb %popuppath $+ \pasen.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 7) { set %tb %popuppath $+ \sinterklaas.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 8) { set %tb %popuppath $+ \kerst.txt | did -r slap 1 | naam }
        if ($4 == 11) && ($5 == 9) { set %tb %popuppath $+ \oudennieuw.txt | did -r slap 1 | naam }
        if ($4 == 12) { set %tb %popuppath $+ \geluid.txt | did -r slap 1 | naam }
        if ($4 == 12) && ($5 == 2) { set %tb %popuppath $+ \A-E.txt | did -r slap 1 | naam }
        if ($4 == 12) && ($5 == 3) { set %tb %popuppath $+ \F-K.txt | did -r slap 1 | naam }
        if ($4 == 12) && ($5 == 4) { set %tb %popuppath $+ \L-R.txt | did -r slap 1 | naam }
        if ($4 == 12) && ($5 == 5) { set %tb %popuppath $+ \S-Z.txt | did -r slap 1 | naam }
        if ($4 == 13) { set %tb %popuppath $+ \humor.txt | did -r slap 1 | naam }
        if ($4 == 13) && ($5 == 2) { set %tb %popuppath $+ \gewoon.txt | did -r slap 1 | naam }
        if ($4 == 13) && ($5 == 3) { set %tb %popuppath $+ \schunnig.txt | did -r slap 1 | naam }
        if ($4 == 14) { set %tb %popuppath $+ \erotisch.txt | did -r slap 1 | naam }
        if ($4 == 15) { set %tb %popuppath $+ \sex.txt | did -r slap 1 | naam }
        if ($4 == 15) && ($5 == 2) { set %tb %popuppath $+ \normaal.txt | did -r slap 1 | naam }
        if ($4 == 15) && ($5 == 3) { set %tb %popuppath $+ \man-vrouw.txt | did -r slap 1 | naam }
        if ($4 == 15) && ($5 == 4) { set %tb %popuppath $+ \vrouw-man.txt | did -r slap 1 | naam }
        if ($4 == 15) && ($5 == 5) { set %tb %popuppath $+ \vrouw-vrouw.txt | did -r slap 1 | naam }
        if ($4 == 15) && ($5 == 6) { set %tb %popuppath $+ \man-man.txt | did -r slap 1 | naam }
        if ($4 == 16) { set %tb %popuppath $+ \geweld.txt | did -r slap 1 | naam }
        if ($4 == 16) && ($5 == 2) { set %tb %popuppath $+ \schelden.txt | did -r slap 1 | naam }
        if ($4 == 16) && ($5 == 3) { set %tb %popuppath $+ \slaan.txt | did -r slap 1 | naam }
        if ($4 == 16) && ($5 == 4) { set %tb %popuppath $+ \schoppen.txt | did -r slap 1 | naam }
        if ($4 == 16) && ($5 == 5) { set %tb %popuppath $+ \akties.txt | did -r slap 1 | naam }
      }     
    }
  }
  if ($devent == close) { 
    window -c @preview
  }
}

dialog slap {
  title $_(pm40)
  size 593 0 213 148
  option dbu
  icon $icondir $+ scrippie.ico, 0
  list 1, 76 6 70 128, size hsbar
  button $_(pm41), 2, 2 135 50 12
  button $_(pm42), 3, 55 135 50 12
  button $_(pm43), 4, 161 135 50 12
  button $_(pm44), 5, 108 135 50 12
  combo 8, 150 6 60 140, size vsbar drop
  list 7, 150 17 60 117, size sort
  list 10, 2 6 70 128, size
}

Bullseye #210225 09/03/09 12:58 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You can get around the $1 issue by doing a simple tokenize 32 %nick just before the slap command is issued, but the $chan issue is more complex. You're not going to be able to solve the $chan issue without rewriting the script so it works a lot differently.

Why dont you just find/replace all instances of $1 and $chan in notepad?

hixxy #210230 09/03/09 04:32 AM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
thank you

i'll stick to the find/replace
The other one is going to take wat to much of my time.


Link Copied to Clipboard