Well a small piece to a big puzzle... There's code that will calculate the width for you. From the help docs:
$width(text,font,size,B,C)
Returns width of text in pixels for the specified font.
If B is non-zero, the font is bold, if C is non-zero, control codes are processed. Both B and C are optional.
Note: If you use a negative number for the font size, it will match the size of fonts in the font dialog.
the echo is failing on the empty line after the header information. For the purposes of your testing, replace line 36 with:
echo -a $iif(%result,$v1,$chr(160))
This way it doesn't end up with nothing to echo on a blank line.
If your script only returns 1 or 0, you can be confident in:
if (%result isnum) { we have our number, 1 or 0, stored in %result. do stuff! }
Also make sure your php is sending PHP_EOL (end of line) so mIRC knows the line is done, as your code, even when that echo fails, should continue!
Last but not least.... Questions should go in the forums, not snippets!
If you were to set all of your variables like so:
%duel.fight
%duel.player1
%duel.player2
this would avoid it not playing well with other scripts, and also allow you to do this:
unset %duel.*
and unset them all in one go.
I would also suggest trying to learn hash tables, and they would be better suited to this purpose.
A couple of things you could do:
because you have FILEPATH in multiple places, try this at the top, so you only need to set it once. Then call it with $FILEZILLA_FILEPATH.
alias -l FILEZILLA_FILEPATH return FILEPATH
your server and channel could be set this way (called a constant) as well, so you aren't using extraneous variables. As far as why you have a specific server set, it looks to be so it automatically starts only on the IRC server you want (incase you connect to multiple).
I also suggest commenting the hell out of your code. Every couple of lines or every scope change, so you know what you're doing there if you ever have to come back to it.
Where is the ini file created? Since the servers are listed there, shouldn't there be more than just writeini's for choosing whether a server is on or off?
And further, though I know that it likely won't cause any harm, you should have 3 sections of your INI file. one would be =, one would be =, and one =<enabled?>. ID would be an auto-incrementing number, maybe stored in a 4th section. Yes, this sounds like overkill, but it's good programming practice, incase you want to add more information (description? channel list?) in the future.
Alright, so I know the point is to be mirthful and not have any real use, but isn't it a little silly, considering you would have to somehow get your target to load a script that spells out "you PC is dead."? You might find this useful, too:
; ascii numbers, space delimited, converted to string
alias a2s {
; define our variables
var %ceiling = $0,%iterator = 1,%string,%number
; get through the numbers
while (%iterator <= %ceiling) {
; what is our number?
%number = $ [ $+ [ %iterator ] ]
; is it actually a number? if not, just quit now.
if (%number !isnum) { return $false }
; We're here? good! It's a number
; add the corresponding character to the string, replacing spaces with something outrageous to keep track of them later
%string = %string $+ $chr($iif(%number == 32,12345,$v1))
; move on
inc %iterator
}
; we have our built string with the replaced spaces. Let's change those back and wrap this show up
%string = $replace(%string,$chr(12345),$chr(32))
if ($isid) {
return %string
}
echo -a %string
}
; string to ascii numbers, string delimited.
alias s2a {
; set the variables
var %ceiling = $len($1-),%iterator = 1,%string
; get through each character in the string
while (%iterator <= %ceiling) {
; add the next number
%string = %string $asc($mid($1-,%iterator,1))
; move on
inc %iterator
}
; we have our numbers, let's wrap things up!
if ($isid) {
return %string
}
echo -a %string
}
Oh, also, you don't need the "/" at the beginning of each line in the alias, as evident by my snippet above.
@Spoof
Just letting you know that I was, in fact, right. With echo, the color comes before the switches.
I'll save everybody's time...
---------------------
Bad Nick Protection |
Write By ~>MR.KolanG |
_____________________
on *:NICK:{
IF ((fuck isin $newnick) || (shit isin $newnick) || (Bad isin $newnick)) {
VAR %i = 0
WHILE (%i < $comchan($newnick,0)) {
INC %i
ban -u60 $comchan($newnick,%i) $newnick 3
kick $comchan($newnick,%i) $newnick Please CHange Nick!!
}
}
}
; Botserv Possessor Version 2
; ( Was named Chanserv Possesor )
; This uses the TMFKSOFT Coder Tools http://www.hawkee.com/snippet/9172/
; By Thomas Edwards (TMFKSOFT) 2011
; Simply right click and select "Possess bot on #channel" or "Unpossess bot on #channel"
; Yes, it is now channel specific
menu channel {
BotServ Possessor
. $iif($getvar($network,$chan,possessed) == 1,Unpossess,Possess) $chan $+ 's bot:/possess
}
alias -l possess {
if ($getvar($network,$chan,possessed) == 1) {
echo 4[BotServ Possessor] You no longer possess $chan $+ 's bot.
away
unsetvar $network $chan possessed
}
else {
if ($me isop $chan) {
echo 4[BotServ Possessor] You now possess $chan $+ 's bot.
away I am possesing the bot on $chan via http://www.hawkee.com/snippet/9251/
setvar $network $chan possessed 1
}
else {
echo 4[BotServ Possessor] Operator or above is required to possess $chan $+ s bot.
}
}
}
on 1:input:#:{
if ($getvar($network,$chan,possessed) == 1) {
if ($1 == /me) {
raw -q privmsg botserv :act $chan $2-
HALT
}
else if ($1 == /topic) {
raw -q privmsg chanserv :topic $chan $2-
HALT
}
else if ( isin $1) {
raw -q privmsg botserv :say $1-
HALT
}
else if ($left($1,1) == /) {
$1-
HALT
}
else {
raw -q privmsg botserv :say $chan $1-
HALT
}
}
}
alias setvar {
set % $+ $1 $+ . $+ $2 $+ . $+ $3 $4-
}
alias getvar {
return % [ $+ [ $1 ] $+ . $+ [ $2 ] $+ . $+ [ $3 ] ]
}
alias unsetvar {
unset % $+ $1 $+ . $+ $2 $+ . $+ $3
}
Adapted for a multi-network situation in which you might be in #chan on two different networks.
Good script
Cheers :)