mIRC Home    About    Download    Register    News    Help

Print Thread
$$$ chaos! #26875 29/05/03 01:16 PM
Joined: Jan 2003
Posts: 109
S
SpaceBoy Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
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!


#Newsroom
Where News & Markets Connect
http://www.inewsroom.net
Re: $$$ chaos! #26876 29/05/03 01:31 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
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)

Re: $$$ chaos! #26877 29/05/03 01:33 PM
Joined: Dec 2002
Posts: 54
L
laz Offline
Babel fish
Offline
Babel fish
L
Joined: Dec 2002
Posts: 54
Use $chr(36) $+ min

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

Re: $$$ chaos! #26878 29/05/03 01:45 PM
Joined: Jan 2003
Posts: 109
S
SpaceBoy Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
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
}


#Newsroom
Where News & Markets Connect
http://www.inewsroom.net
Re: $$$ chaos! #26879 29/05/03 04:00 PM
Joined: Dec 2002
Posts: 699
N
Nimue Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
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
}

Re: $$$ chaos! #26880 30/05/03 12:14 AM
Joined: Jan 2003
Posts: 109
S
SpaceBoy Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
great - it's working perfectly now - thanks guys! much appreciated! =)


#Newsroom
Where News & Markets Connect
http://www.inewsroom.net
Re: $$$ chaos! #26881 30/05/03 12:20 AM
Joined: Dec 2002
Posts: 699
N
Nimue Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
You're welcome. smile

Re: $$$ chaos! #26882 30/05/03 03:50 AM
Joined: Jan 2003
Posts: 109
S
SpaceBoy Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
...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!


#Newsroom
Where News & Markets Connect
http://www.inewsroom.net
Re: $$$ chaos! #26883 30/05/03 10:47 AM
Joined: Dec 2002
Posts: 699
N
Nimue Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
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
  }
}

Re: $$$ chaos! #26884 30/05/03 02:49 PM
Joined: Jan 2003
Posts: 109
S
SpaceBoy Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
thank you again Nimue - working beautifully!

laugh


#Newsroom
Where News & Markets Connect
http://www.inewsroom.net