|
Joined: Feb 2005
Posts: 344
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2005
Posts: 344 |
I have this popup manager wich i made with the help of some friends. It show a preview of the popup before you send it into the room. It shows the popup in a @window. The thing is in the preview it shows the popups as one big line even when the popup in the room shows as multiple lines. We can't find how to fix this everything else works fine. Below the code there is some text that shows how the popups are stored in the .txt file. The popups are flags i think that is the best to show. Here is the code: alias mdx.load { mdx SetMircVersion $version | mdx MarkDialog $dname }
alias mdx dll $scriptdirdll\mdx.dll $1-
alias views return $scriptdirdll\views.mdx $1-
alias preview {
var %nick = $did(7).seltext
var %font = $window(Status Window).font,%size = $window(Status Window).fontsize,%x = $calc($dialog(slap).x +1),%y = $calc($dialog(slap).y + 346),%text = $gettok($read(%tb,t, $did(1).sel),2-,124),%w = $iif($calc($window(-1).w - %x) < 602,$calc($v1 - 4),$v2),%text.w = $width($burcwrap(%text,%font,%size,$calc(%w -4),1,1),%font,%size,0,1),%w = $calc(%text.w + 6),%lines = $burcwrap(%text,%font,%size,%w,1,0),%line.h = $height(%text,%font,%size),%text.h = $calc(%lines * %line.h),%h = $iif($calc($window(-1).h - %y) < $calc(%text.h + 6),$calc($v1 -2),$v2)
if ($window(@slap.preview)) {
var %wnd = $ifmatch
window -f %wnd %x %y %w %h
}
else {
window -pdk0fhB +dL @slap.preview %x %y %w %h
}
window -o @slap.preview
drawrect -rf @slap.preview 15794175 1 0 0 %w %h
;15794175
drawrect -r @slap.preview 0 1 0 0 %w %h
var %q = 1
while (%q <= %lines) {
var %drawtext = $burcwrap(%text,%font,%size,$calc(%w -4),1,%q)
drawtext -bpr @slap.preview $color($color(action)) 15794175 %font %size 4 $calc((%q -1) * %line.h +2) %drawtext
inc %q
}
}
alias burcwrap {
var %text = $1, %c $chr(44)
tokenize 44 $+($2,%c,$3,%c,$4,%c,$iif($0 == 5,1 $+ %c),$$5,%c,$6)
if ($istok(1.0,$5,46) == $true) {
return $wrap(%text,$1,$2,$3,$4,$5)
}
var %regex = /(\d{0,2})/g, %regex2 /\d{0,2},(\d{1,2})/g, %b = 1,
var %str, %cc1, %cc2
while (%b < $($ $+ $0,2)) {
%str = %str $+ $wrap(%text,$1,$2,$3,$4,%b)
inc %b
}
if ($regex(%str,%regex)) %cc1 = $regml($regml(0))
if ($regex(%str,%regex2) > 0) %cc2 = $regml($regml(0))
if (%cc1 $+ %cc2) var %cc = $+(,%cc1,$iif(%cc2,$chr(44) $+ %cc2))
return $iif(2 \\ $count(%str,) ,) $+ $iif(2 \\ $count(%str,),) $+ $&
$iif(2 \\ $count(%str,),) $+ $iif(%cc,%cc) $+ $wrap(%text,$1,$2,$3,$4,$5)
}
dialog slap {
title "Slap Manager"
size -1 -1 360 158
option dbu
icon $icodir $+ scrippie.ico, 0
list 1, 76 16 217 128, size hsbar
button "Wilekeurige popup", 2, 77 145 50 12
button "Gekozen popup", 3, 135 145 50 12
button "Popup verwijderen", 4, 256 145 50 12
button "Popup toevoegen", 5, 196 145 50 12
combo 8, 297 16 60 140, size vsbar drop
list 7, 297 27 60 117, size sort
text "Totale popups", 6, 7 3 140 8
edit "", 9, 297 3 60 10, read
list 10, 2 16 70 128, size
}
on *:dialog:slap:*:*:{
if (!$istok(mouse edit,$devent,32) && $did != 3 && $active != @slap.preview && $window(@slap.preview)) { window -c $ifmatch }
if ($devent == init) {
mdx.load
mdx SetControlMDX $dname 10 TreeView haslines linesatroot hasbuttons showsel > $views
did -i $dname 10 1 setcolor text $color(1)
did -i $dname 10 1 setcolor bkg $color(0)
did -i $dname 10 1 setcolor line $color(6)
did -a $dname 10 Knuffelen
did -a $dname 10 Zoenen
did -a $dname 10 Bedankt
did -a $dname 10 Sorry
did -a $dname 10 Plaatjes
did -a $dname 10 Smiley's
did -a $dname 10 Vlaggen
did -a $dname 10 Gezichten
did -a $dname 10 Nep modes
did -a $dname 10 Gelegenheden
did -i $dname 10 1 cb last
did -a $dname 10 Verjaardag
did -a $dname 10 Trouwen
did -a $dname 10 Jubileum
did -a $dname 10 Geboorte
did -a $dname 10 Pasen
did -a $dname 10 Sinterklaas
did -a $dname 10 Kerst
did -a $dname 10 Oud en Nieuw
did -i $dname 10 1 cb up
did -a $dname 10 Met geluid
did -i $dname 10 1 cb last
did -a $dname 10 A-E
did -a $dname 10 F-K
did -a $dname 10 L-R
did -a $dname 10 S-Z
did -i $dname 10 1 cb up
did -a $dname 10 Humor
did -i $dname 10 1 cb last
did -a $dname 10 Gewoon
did -a $dname 10 Schunnig
did -i $dname 10 1 cb up
did -a $dname 10 Erotisch
did -a $dname 10 Sex
did -i $dname 10 1 cb last
did -a $dname 10 vanalles
did -a $dname 10 Man-Vrouw
did -a $dname 10 Vrouw-man
did -a $dname 10 Vrouw-vrouw
did -a $dname 10 Man-man
did -i $dname 10 1 cb up
did -a $dname 10 Geweld
did -i $dname 10 1 cb last
did -a $dname 10 Schelden
did -a $dname 10 Slaan
did -a $dname 10 Schoppen
did -a $dname 10 Akties
did -i $dname 10 1 cd root
did -r slap 1
loadbuf -o slap 1 $scriptdir\popups\slap.txt
did -r slap 9
did -a slap 9 Total Slaps: $lines($scriptdir\popups\slaps.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 $?="Slap to add"
did -r slap 1
loadbuf -o slap 1 %tb
did -r slap 9
did -a slap 9 Total Quotes: $lines($scriptdir\popups\slaps.txt)
}
if ($did == 4) {
write -dl $+ $did(1).sel %tb
did -r slap 1
loadbuf -o slap 1 %tb
did -r slap 9
did -a slap 9 Total Quotes: $lines($scriptdir\popups\slaps.txt)
}
if ($did == 3) {
var %ik = $did(8).text
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, $did(1).sel),2-,124)
}
if ($did == 2) {
var %ik = $did(8).text
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 $scriptdir\popups\knuffel.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 3) { set %tb $scriptdir\popups\zoenen.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 4) { set %tb $scriptdir\popups\bedankt.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 5) { set %tb $scriptdir\popups\sorry.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 6) { set %tb $scriptdir\popups\plaatjes.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 7) { set %tb $scriptdir\popups\smiley.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 8) { set %tb $scriptdir\popups\vlaggen.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 9) { set %tb $scriptdir\popups\gezichten.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 10) { set %tb $scriptdir\popups\nepmodes.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) { set %tb $scriptdir\popups\gelegenheden.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 2) { set %tb $scriptdir\popups\verjaardag.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 3) { set %tb $scriptdir\popups\trouwen.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 4) { set %tb $scriptdir\popups\jubileum.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 5) { set %tb $scriptdir\popups\geboorte.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 6) { set %tb $scriptdir\popups\pasen.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 7) { set %tb $scriptdir\popups\sinterklaas.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 8) { set %tb $scriptdir\popups\kerst.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 11) && ($5 == 9) { set %tb $scriptdir\popups\oudennieuw.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 12) { set %tb $scriptdir\popups\geluid.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 12) && ($5 == 2) { set %tb $scriptdir\popups\A-E.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 12) && ($5 == 3) { set %tb $scriptdir\popups\F-K.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 12) && ($5 == 4) { set %tb $scriptdir\popups\L-R.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 12) && ($5 == 5) { set %tb $scriptdir\popups\S-Z.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 13) { set %tb $scriptdir\popups\humor.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 13) && ($5 == 2) { set %tb $scriptdir\popups\gewoon.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 13) && ($5 == 3) { set %tb $scriptdir\popups\schunnig.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 14) { set %tb $scriptdir\popups\erotisch.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 15) { set %tb $scriptdir\popups\sex.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 15) && ($5 == 2) { set %tb $scriptdir\popups\normaal.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 15) && ($5 == 3) { set %tb $scriptdir\popups\man-vrouw.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 15) && ($5 == 4) { set %tb $scriptdir\popups\vrouw-man.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 15) && ($5 == 5) { set %tb $scriptdir\popups\vrouw-vrouw.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 15) && ($5 == 6) { set %tb $scriptdir\popups\man-man.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 16) { set %tb $scriptdir\popups\geweld.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 16) && ($5 == 2) { set %tb $scriptdir\popups\schelden.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 16) && ($5 == 3) { set %tb $scriptdir\popups\slaan.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 16) && ($5 == 4) { set %tb $scriptdir\popups\schoppen.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
if ($4 == 16) && ($5 == 5) { set %tb $scriptdir\popups\akties.txt | did -r slap 1 | loadbuf -o slap 1 %tb }
}
}
}
}
USA | %act 0,12 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,12 * * * * * * * 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,12 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0 * * * * * * * 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ United States of America
Malaysia | %act 12,12¯¯¯¯8,12/12,12¯*¯¯¯¯4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 12,12¯¯¯¯8,12\12,12¯8,12*12,12¯¯¯¯0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4¯¯¯¯\¯*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0¯¯¯¯\¯*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4¯¯¯¯\¯*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Malaysia
Israel | %act 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 12,12¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 12,12¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Israel
Portugal | %act 3,3¯¯¯¯¯4,4¯¯¯¯¯¯¯¯¯ | %act 3,3¯¯¯¯¯4,4¯¯¯¯¯¯¯¯¯ | %act 3,3¯¯¯¯¯4,4¯¯¯¯¯¯¯¯¯ Portugal
Spain | %act 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 8,8¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Spain
Thanks for helping Greetzz
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
USA | %act 0,12 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,12 * * * * * * * 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,12 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0 * * * * * * * 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ United States of America
Malaysia | %act 12,12¯¯¯¯8,12/12,12¯*¯¯¯¯4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 12,12¯¯¯¯8,12\12,12¯8,12*12,12¯¯¯¯0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4¯¯¯¯\¯*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0¯¯¯¯\¯*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4¯¯¯¯\¯*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Malaysia
Israel | %act 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 12,12¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 12,12¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Israel
Portugal | %act 3,3¯¯¯¯¯4,4¯¯¯¯¯¯¯¯¯ | %act 3,3¯¯¯¯¯4,4¯¯¯¯¯¯¯¯¯ | %act 3,3¯¯¯¯¯4,4¯¯¯¯¯¯¯¯¯ Portugal
Spain | %act 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 8,8¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | %act 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Spain
well there is your problem right there the @window isnt going to parse the | pipe change your format to USA { %act 0,12 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ %act 0,12 * * * * * * * 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ %act 0,12 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ %act 0,0 * * * * * * * 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯ %act 4,4 * * * * * * * 4,4¯¯¯¯¯¯¯¯¯¯¯¯¯¯ United States of America }
|
|
|
|
Joined: Feb 2005
Posts: 344
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2005
Posts: 344 |
sorry it doesn't work. The preview doesn't shows anything now. Also the popup will not send to the channel. I heard something about a tokenize loop looping from every |. the popup is in 1 line else the script doesn't read it correct. the | is so the line is broken and will show up correctly in the channel.
|
|
|
|
Joined: Jun 2006
Posts: 506
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 506 |
Does adding the "p" switch to the $read() help? $read(filename, [ntswrp], [matchtext], [N]) If the p switch is specified, command | separators are treated as such instead of as plain text.
|
|
|
|
Joined: Feb 2005
Posts: 344
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2005
Posts: 344 |
no i tryed that. This is the part of the code that takes care of the preview: %text = $gettok($read(%tb,t, $did(1).sel),2-,124) It is located in the alias preview I tryed some things with it including the "p" In normal mirc scriting a | will start a new line that is why i use it in the txt files. But in $read it will just see it as text and display iteccept for the first one because i start reading from that one. This means a loop of somekind should do the trick. But i have no idea where and how to start.
Last edited by Bullseye; 17/10/06 05:55 PM.
|
|
|
|
Joined: Mar 2003
Posts: 612
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Mar 2003
Posts: 612 |
%text = $gettok($read(%tb,t, $did(1).sel),%q,124)
?
[edit] I think it would need to be IN the while loop for that to work instead of the top line.
Last edited by billythekid; 17/10/06 06:05 PM.
billythekid
|
|
|
|
Joined: Jun 2006
Posts: 506
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 506 |
Any particular reason you need a picture window for the preview?
|
|
|
|
Joined: Feb 2005
Posts: 344
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2005
Posts: 344 |
no not really i already had the code of thatpicture window so i used it again. your free to give any other options.
|
|
|
|
Joined: Jun 2006
Posts: 506
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 506 |
Well, this is oversimplified a bit, you'll need to add in your size calcs and so forth yourself alias slap.preview {
var %act = echo @slap.preview
window -dkf @slap.preview 99 539 539 347
noop $read(file.txt,p,$1)
}
The filename is not the same as your filename /slap.preview <line number>
|
|
|
|
Joined: Feb 2005
Posts: 344
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2005
Posts: 344 |
Not all popups start with %act for starters. window -dkf @slap.preview 99 539 539 347 is the size of the window right? little big for a one line popup.the picwin window addapts to the size of the popup.
|
|
|
|
Joined: Jun 2006
Posts: 506
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 506 |
Read the first line again  Well, this is oversimplified a bit, you'll need to add in your size calcs and so forth yourself ALL of the examples you showed start with %act. If others dont just set them to the same thing. var %act = echo @preview, %somethingelse = echo @preview etc.
|
|
|
|
|