I've tried to optimize my betting script posted previously and I've got a pretty good feeling about it, although there's one problem that I still face. Every time I execute a command to tell me which users entered their bets on a certain outcome, it'll tell me the name and points entered through Echo. As soon as I decide I want to have my script write the points, it'll tell me I have insufficient parameters and stop the script.
I'm guessing this is to do with the blank space, meaning the script can't write it as a parameter and therefore halts before I can finish the script.
The lay-out of the list. This simulates a situation where one of the people that bet on a match decided they didn't want to risk it and removed their entry. I'll either need a way to completely remove blanks altogether and shrink the file together , or to be able to skip this blank line.
The code being used
on *:TEXT:!cmd:#: {
var %i = 1, %l = $lines(Win.txt)
while (%i <= %l) {
echo 9 @Script Entry: $read(Win.txt,n,%i)
echo 3 @Script Points: $readini(Bets.ini,n,$+(#), $read(Win.txt,n,%i))
inc %i
}
}
Code's outcome in @Script
Entry: User0
Points: 20
Entry: User1
Points: 2
Entry:
Points:
Entry: User3
Points: 4
Once I want to write points:
on *:TEXT:!cmd:#: {
var %i = 1, %l = $lines(Win.txt)
while (%i <= %l) {
echo 9 @Script Entry: $read(Win.txt,n,%i)
echo 3 @Script Points: $readini(Bets.ini,n,$+(#), $read(Win.txt,n,%i))
writeini -n Points.ini $+(#) $read(Win.txt,n, %i) $calc($readini(Points.ini,$+(#),$read(Win.txt, n, %i)) + $round($calc($readini(Bets.ini,$+(#),$read(Win.txt,n, %i)) * 1.5) ,0))
inc %i
}
}
Outcome in Status and @Script
Status window:
* /writeini: insufficient parameters (line 75, remote.ini)
@Script window:
Entry: User0
Points: 20
Entry: User1
Points: 2
Entry:
Points: