mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 237
X
xrn0id Offline OP
Fjord artisan
OP Offline
Fjord artisan
X
Joined: Jan 2003
Posts: 237
I have a script that enables you to add/remove bots to a database. Well, everything works except for one part, I want it to remove the entry; yes, but i want it to leave the line there, so all the number say the same. ex.

1. test

3. test

so that way, if you delte 2, it WONT look like this:

1. test
3. test

thus making 3 report as 2, yada yada yada. Ill highligh the part of the code to look at. thanks.

Code:
on *:TEXT:!bot*:#ftpxdcc-wolf-botholding:{
  if ($nick isop $chan) {
    if ($2 == add) {
      set %bot_sub $nick
      set %bot_ip $3
      set %bot_speed $4
      set %bot_nick $5
      set %bot_admin $6
      set %bot_owner $7
      set %bots $calc(%bots + 1)
      write xdccbots.txt 12 %bots $+ . «« Bot.IP: %bot_ip »» «« Bot.Pass: %bot_admin »» «« Bot.Nick: %bot_nick »» $&
        «« Bot.Owner: %bot_owner »» «« Bot.Speed: %bot_speed »»7 sub. by %bot_sub
      unset %bot_sub
      unset %bot_ip
      unset %bot_speed
      unset %bot_owner
      unset %bot_admin
      unset %bot_nick
      .notice $nick 12Bot Stored - Thankyou
      .notice $nick 12Entry Number:7 %bots
      goto done
    }
    if ($2 == remove) {
      set %bot_deletego 1
      set %bot_lineremove $3
      set %bot_tempok $nick
      .notice $nick 4!WARNING! 1This Will Delete The Bot Off The Database FOREVER. Continue? (Y/N) 4!WARNING!
    }
    if ($2 == read) {
      set %bot_line $3
      set %bot_readline $read(xdccbots.txt, %bot_line)
      .notice $nick %bot_readline
      .notice $nick 4Done
      unset %bot_line
      unset %bot_readline
      goto done
    }
    if ($2 == help && $3 == $null) {
      .notice $nick 12XDCC Bot Database 7[Entrys: %bots $+ ]
      .notice $nick 1Command listing and bot help
      .notice $nick 1syntax: 4!bot <command> (parameter(s))
      .notice $nick 12TOPICS:
      .notice $nick 4HELP 1 $chr(124) 4 ADD 1 $chr(124) 4 REMOVE 1 $chr(124) 4 READ 1 $chr(124) $&
        12 SEND 1 $chr(124) 12 BACKUP 1 $chr(124) 7 RESET
      .notice $nick 1-
      .notice $nick 4Red: Any op
      .notice $nick 12Blue: Authorized OP's only
      .notice $nick 7Orange: Me :-]
      goto done
    }
    elseif ($2 == help && $3 == add) {
      .notice $nick 12XDCC Bot Database 7[Entrys: %bots $+ ]
      .notice $nick 1syntax: 4!bot add <ip> <speed> <nick> <admin pass> <owner>
      .notice $nick 12You MUST set all fields!
      goto done
    }
    elseif ($2 == help && $3 == remove) {
      .notice $nick 12XDCC Bot Database 7[Entrys: %bots $+ ]
      .notice $nick 1syntax: 4!bot remove <bot number>
      .notice $nick 12Ranges NOT supported yet. soon.
      goto done
    }
    :done
    halt
  }
}
[color:blue]
on *:TEXT:y:#ftpxdcc-wolf-botholding:{
  if (%bot_deletego == $null) halt
  if (%bot_deletego == 1) {
    .notice $nick 4Deleting $read(xdccbots.txt, %bot_lineremove)
    write -ds $+ %bot_lineremove $+ . xdccbots.txt
    unset %bot_deletego
    unset %bot_lineremove
    unset %bot_tempok
  }
}
[/color]
on *:TEXT:n:#ftpxdcc-wolf-botholding:{
  if (%bot_deletego == $null) halt
  if (%bot_deletego == 1) {
    .notice $nick 4Cancled Delete
    unset %bot_deletego
    unset %bot_lineremove
    unset %bot_tempok
  }
}

Last edited by Hammer; 02/03/03 04:15 PM.


;Check for Life

if (%life == $null) {
goto getlife
}
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Perhaps, replace the /write with this one:
Code:

write -s" $+ %bot_lineremove $+ ." xdccbots.txt $crlf

This one clears the first line beginning with %bot_lineremove $+ .

Joined: Feb 2003
Posts: 83
L
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
Code:
 
on *:TEXT:y:#ftpxdcc-wolf-botholding:{  
if (%bot_deletego == $null) halt 
 if (%bot_deletego == 1) {
.notice $nick 4Deleting $read(xdccbots.txt, %bot_lineremove)    
write -ds $+ %bot_lineremove $+ . xdccbots.txt   
 unset %bot_deletego  %bot_lineremove  %bot_tempok  
}
}


Now, Assuming %bot_lineremove is the line in the file...
Try puting write -il $+ %bot_lineremove xdccbots.txt which will insert a blank line at line number %bot_lineremove in the txt file, of course you can always put sumthin there to let you know that spot is open, or whatever, but i think you should have enough info to get you thru your problem. laugh


any help would make me happy
Joined: Jan 2003
Posts: 237
X
xrn0id Offline OP
Fjord artisan
OP Offline
Fjord artisan
X
Joined: Jan 2003
Posts: 237
ok thanks guys, that helped alot.



;Check for Life

if (%life == $null) {
goto getlife
}

Link Copied to Clipboard