coding articles

CSM Tryout Profit

calculates your tryout profit

1816 Views



Just paste this code in a new remote file of your IRC client (alt + r). Then copy the whole transfer history in a file called to-ori.txt and put it in your mirc folder (e.g. users/username/roaming/irc). Then you can also add a startteamvalue if you still know how much money you made selling your starting players as these are not substracted automatically by the script.



alias to {

var %feil = to-ori.txt

var %len = $lines(%feil)

var %runner = 1

var %winwin = 0

var %startteam = 0




while (%runner <= %len) { %lein = $read(%feil,nt,%runner)
if (* 0%* iswm %lein) {

var %for = $findtok(%lein,for,1,32)

var %csm = $findtok(%lein,csm,1,32)

inc %winwin

$calc($remove($gettok(%lein,$+($calc(%for + 1),-,$calc(%csm - 1)),32),$chr(32)) - 4000)

}

inc %runner }

msg $chan Total money made with tryouts: $dot(%winwin - %startteam) csm
}




alias dot {

var %dot.incoming $1-



if (($left(%dot.incoming,1) == -) || ($left(%dot.incoming,1) == +)) { var %sign = $left(%dot.incoming,1) }
if $chr(44) isin %dot.incoming || $chr(46) isin %dot.incoming {

var %first = $gettok(%dot.incoming,1,$asc($v1))

var %last = $gettok(%dot.incoming,2,$asc($v1))

}

else { var %first %dot.incoming }

tokenize 32 $remove(%first,-)



var %counter = $len($1),%dotted
while (%counter) {

if ($right($1,3) != $null) {

%dotted = $+($ifmatch,$iif(%dotted != $null,$chr(39)),%dotted)

tokenize 32 $left($1,-3)

}

dec %counter 3

if (%counter < 0) { unset %counter }

}

return %sign $+ $iif(%dotted,%dotted,0) $+ $iif(%last,$chr(46) $+ %last)

}


Links: related

Saturday 8th of October 2011 at 16:58

Share




comments


No comments yet.


Name

Message

You can post URLs (will be clickable automatically) and images via the [img]http://picurl[/img] tag.

Calculate 7 minus 3 (Robot check)

Back to Top

show elements