mIRC Homepage

$$$ chaos!

Posted By: SpaceBoy

$$$ chaos! - 29/05/03 01:16 PM

Hi

I have a script that reads lines of news from a txt file into a channel. As the headlines are financially related, often they have $ signs in them referring to money (obviously!), however, since the script uses several identifiers like $mid etc to return the text, the $ signs in the headline news are ignored, as are any numbers with it. eg '$20mln' is just returned as 'mln'.

I'm wondering if there's a way around this? Would appreciate any ideas!

Thanks alot!
Posted By: ScatMan

Re: $$$ chaos! - 29/05/03 01:31 PM

yeah, since $read evalute identifiers and variable so identifiers that are not exist doesn't returns nothing that's why u think it's ignored (it returned NULL)
so there is ,n, switch that return it as plain text, like:
$read(file.txt,n,LINE)
Posted By: laz

Re: $$$ chaos! - 29/05/03 01:33 PM

Use $chr(36) $+ min

A full list of ASCII characters can be found at http://helpdesk.zaz.net/documents/ASCIITable.php
Posted By: SpaceBoy

Re: $$$ chaos! - 29/05/03 01:45 PM

thanks - since not every headline contains a $, would I have to make an 'if' line?

Here is my code - by the way, I'm new to this so I know it's a little messy - have tried combing this into one line but no luck yet!

/cbs2 {
set %cbs $read(c:\CitiNews\news\cbs.txt,w,*[14]*)
set %cbs2 $remove(%cbs,[14],[15])
set %cbs3 $left(%cbs2,7)
set %cbs4 $mid(%cbs2,17)
{
/msg #NewsRoom 47 %cbs4  %cbs3 ET
}
unset %cbs
}
Posted By: Nimue

Re: $$$ chaos! - 29/05/03 04:00 PM

Did you try Scatmans suggestion?
Code:
cbs2 {
  var %cbs = $remove($read(c:\CitiNews\news\cbs.txt,[color:crimson]n[/color]w,*[14]*),[14],[15])
  msg #NewsRoom 47 $mid(%cbs,17)  $left(%cbs,7) ET
}
Posted By: SpaceBoy

Re: $$$ chaos! - 30/05/03 12:14 AM

great - it's working perfectly now - thanks guys! much appreciated! =)
Posted By: Nimue

Re: $$$ chaos! - 30/05/03 12:20 AM

You're welcome. smile
Posted By: SpaceBoy

Re: $$$ chaos! - 30/05/03 03:50 AM

...one more thing (if I'm not pushing my luck!) - is there also a way to make it so if the line of text has not changed since last time it checked, for it not to msg the channel?

I did have a line that was supposed to do this, but it dosn't work...

thanks again in advance!
Posted By: Nimue

Re: $$$ chaos! - 30/05/03 10:47 AM

You could set a global variable to the result of the read, then check if it has changed.
Code:
cbs2 {
  var %cbs = $remove($read(c:\CitiNews\news\cbs.txt,nw,*[14]*),[14],[15])
  if %cbs2.last != %cbs {
    set %cbs2.last %cbs
    msg #NewsRoom 47 $mid(%cbs,17)  $left(%cbs,7) ET
  }
}
Posted By: SpaceBoy

Re: $$$ chaos! - 30/05/03 02:49 PM

thank you again Nimue - working beautifully!

laugh
© 2021 mIRC Discussion Forums