|
Joined: Feb 2007
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Feb 2007
Posts: 33 |
In this script, when a game is killed it deletes the info so that the game can then again be spawned on a different port. But for some reason, it deletes the wrong info. I dont understand what is wrong with it, can someone help me out.
on *:text:*kill*:#winbolo:{
if ($1 == $me) {
var %killport = $3
if (%killport isin %used.ports) {
var %nick2 = $findtok(%used.ports , $wildtok(%used.ports, * $+ %kill.port , 1, 44), 1, 44)
var %nick1 = $gettok(%used.ports,%nick2,44)
var %nick = $gettok(%nick1,1,46)
if ((($nick == %nick) || ($nick isop #winbolo) || ($nick == %owner))) {
var %nick2 = $findtok(%used.ports , $wildtok(%used.ports, * $+ %kill.port , 1, 44), 1, 44)
set %used.ports $deltok(%used.ports, $calc(%nick2 + 1), 44)
/run $mircdir $+ wonkaDSctl.exe quit $3
msg #winbolo Bang! $nick has just killed game on port $3
}
else msg #winbolo Sorry, only the person that started the game, the bot owner or an op may kill that game.
}
}
} %used.ports in the script would look like this %used.ports ,harl.27500,harl.27501
|
|
|
|
Joined: Feb 2007
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Feb 2007
Posts: 33 |
here, i made it alittle better, but it still doesn't delete the port and name when you type harlbot kill 27508
on *:text:*kill*:#winbolo:{
if ($1 == $me) {
var %killport = $3
var %nick2 = $nick
if (%killport isin %used.ports) {
var %nick1 = $wildtok( %used.ports, $nick $+ * $+ %killport, 1, 44)
var %nick = $gettok( %nick1, 1, 46)
if (((%nick2 == %nick) || ($nick isop #winbolo) || ($nick == %owner))) {
set %used.ports $remtok(%used.ports, %nick1, 1, 44)
/run $mircdir $+ wonkaDSctl.exe quit $3
msg #winbolo Bang! $nick has just killed game on port $3
}
else msg #winbolo Sorry, only the person that started the game, the bot owner or an op may kill that game.
}
}
} %used.ports Harl.27500, Harl.27506, Harl.27508, thats %used.ports in the variable section. Please help, thanks!
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
One point here is your %used,ports variable having spaces before the tokens. This makes your tokens resolve to " Harl.xxxxx" instead of "Harl.xxxxx". If you set it as so -> Harl.27500,Harl.27506,Harl.27508 <- it will work a lot better  BTW, to add tokens to it without spaces, and ensuring there are no doubleups, /set %used.ports $addtok(%used.ports,Nick.12345,44)This code assumes you have removed the spaces from %used.ports first.
on *:text:$($me kill &):#winbolo:{
var %a = . $+ $3
if $matchtok(%used.ports,%a,1,44) {
var %tok = $v1
if $+($nick,%a) == %tok || $nick isop # || $nick == %owner {
run wonkaDSctl.exe quit $3
set %used.ports $remtok(%used.ports,%tok,44)
msg #winbolo Bang! $nick has just killed game on port $3
}
else msg #winbolo Sorry, only the person that started the game, the bot owner or an op may kill that game.
}
else msg #winbolo Sorry, that game wasn't found.
}
|
|
|
|
|