mIRC Homepage

New Script Need a little help

Posted By: confuzzed

New Script Need a little help - 17/09/05 04:05 AM

Ok well i'm back agian and i need a little help and i know "look threw the help file's" I CAN'T i'm on linux and there is NO way to view WINDOWS help files but i don't need much help this is what i have
Code:
on *:TEXT:!fah*:#: {
  if ($nick == confuzzedintelguy) {
    play -q5m1 $chan Y:/unitinfo.txt 1500
  }
}

and that gives me my currnt folding @ home information now my problem is that it displays it in 6 lines which gets a little anoying i was wondering how can i have it display all the lines in one like this
Code:
<ConfuzzedBot>Current Work Unit
              ------------------
              Name: p753_vln2.8nopbc
              Download time: September 16 15:22:37
              Progress: 6%  [__________] 

other then like this
Code:
<ConfuzzedBot>Current Work Unit
<ConfuzzedBot> -----------------
<ConfuzzedBot> Name: p753_vln2.8nopbc
<ConfuzzedBot> Download time: September 16 15:22:37
<ConfuzzedBot> Progress: 6%  [__________]


Thanks for any help you can give me.
Posted By: Om3n

Re: New Script Need a little help - 17/09/05 04:41 AM

There is no way in mirc to simulate a new line in the way you want it too. Other than playing to the channel line by line, you could play to an alias which appends each line to the previous line (using a var) then msg that to the channel. Sample output:

<ConfuzzedBot> Current Work Unit ------------------ Name: p753_vln2.8nopbc Download time: September 16 15:22:37 Progress: 6% [__________]

You could also manipulate the format of the display this way, by having it find just the info you want from each line and ignoring the --- line etc. But then you might as well just use $read or fopen instead of play.
Posted By: confuzzed

Re: New Script Need a little help - 17/09/05 05:03 AM

Quote:
There is no way in mirc to simulate a new line in the way you want it too. Other than playing to the channel line by line, you could play to an alias which appends each line to the previous line (using a var) then msg that to the channel. Sample output:

<ConfuzzedBot> Current Work Unit ------------------ Name: p753_vln2.8nopbc Download time: September 16 15:22:37 Progress: 6% [__________]

That will work thats better then the way it is now because it basicly spam's the room. How would i go about doing that?
Posted By: MikeChat

Re: New Script Need a little help - 17/09/05 05:49 AM

There is no real good way to do that, you could have it all as one line, filled spaces to make it word wrap like you want, and if others have the same rez setting and are using the same font it will look close to what you see. anything else is just going to look spaced weird.

If you want it all in one line to limit the lines sent to the channel (This is not spamming because of the number of lines, that would be flooding) then make it all one line and put in separators like <> or whatever.
Posted By: confuzzed

Re: New Script Need a little help - 17/09/05 05:53 AM

Quote:
There is no real good way to do that, you could have it all as one line, filled spaces to make it word wrap like you want, and if others have the same rez setting and are using the same font it will look close to what you see. anything else is just going to look spaced weird.

If you want it all in one line to limit the lines sent to the channel (This is not spamming because of the number of lines, that would be flooding) then make it all one line and put in separators like <> or whatever.


My problem is i cant edit the file as the file is being wrote to by the program [email]F@H[/email] so even if i edit it, it will in return go back to normal at the next %
Posted By: MikeChat

Re: New Script Need a little help - 17/09/05 06:03 AM

so after it writes the text file you can read it like any normal .txt right?

try this
Code:
alias mystats {
var %lines.tot = $lines(filename.txt)
var %i = 1
while (%i &lt;= %lines.tot) {
var %stats.line =  %stats.line $read(filename.txt,%i) &lt;&gt;
inc %i
}
msg #channelname %stats.line
}

change filename.txt to the actual file name
change #channelname to the actual channel's name

NOTE I typed this out in the msg board reply "box"
Posted By: confuzzed

Re: New Script Need a little help - 17/09/05 06:10 AM

it works very well but it doesnt show the % only
<ConfuzzedBot> ----------------- Name: p1141_RIBO_FSpeptide_HEL_nospring Download time: September 13 13:15:01 Due time: December 4 13:15:01

Thanks again
Posted By: confuzzed

Re: New Script Need a little help - 17/09/05 06:24 AM

nvm it was my error thank you for your help i customized it a little and it works great smile

EDIT: just in case there are any folders in here this is what i did so my bot would show it because i use Xchat to chat and mIRC as my bot because i don't know how to do it in perl smirk

so here is the bot version
Code:
on *:TEXT:!fah*:#: {
  if ($nick == confuzzedintelguy) {
    var %lines.tot = $lines(Y:/unitinfo.txt)
    var %i = 1
    while (%i &lt;= %lines.tot) { 
      var %stats.line =  %stats.line $read(Y:/unitinfo.txt,%i) |
      inc %i
    }
    msg $chan %stats.line
  }
}

you will need to locate your unitinfo.txt file from folding @ home and direct it in the right place

Thanks again
Posted By: Om3n

Re: New Script Need a little help - 17/09/05 06:49 AM

try this, made it call it from an alias so you can use the alias yourself, variables so you can edit the msg line to customise output easily, fopen for speed (not noticable) and so if the file changes location it only needs to be changed in one place.

Code:
on *:TEXT:!fah:#: {
  if ($nick == confuzzedintelguy) fah
}
alias fah {
  .fopen fah Y:/unitinfo.txt
  .fseek -l fah 3
  var %name = $gettok($fread(fah),2-,58)
  var %time = $gettok($fread(fah),2-,58)
  var %prog = $gettok($fread(fah),2-,58)
  .fclose fah
  msg $chan Current Work Unit: 'Name' %name 'Download Time' %time 'Progress' %prog
}
© 2022 mIRC Discussion Forums