Jump to content

Code


JOhnson

Recommended Posts

:oops:I was given this code ages ago to use ...

 

menu channel {
-
  .Fact ( $+ %fact $+ )
  ..On:{ .enable #fact | set %fact On | echo $active 8,4-=[ fact On ]=- }
  ..Off:{ .disable #fact  | set %fact Off | echo $active 8,4-=[ fact Off ]=- }
}

#Fact on
on *:TEXT:*!fact*:*: { 
  if (%fact == off) halt
  set %posi $findtok($1-,$matchtok($1-,!fact,1,32),1,32) 
  var %svalue = $ [ $+ [ %posi ] ] 
  if (%svalue == !fact) { msg # Heres A Fact For You $nick - $read(Facts/fact.txt) } 
  elseif (!fact isin %svalue) && (%svalue != !fact) && ($right(%svalue,-5) isnum) { 
  msg # Heres A Fact For You $nick - $read(Facts/fact.txt,$right(%svalue,-5)) } 
  set -u10 %fact off 
}

 

Now when I type !fact it will read the txt.doc at random from the txt.doc and if I type !fact1 it will read the 1st line in the txt.doc

 

QUESTION: all iv done is to do copy the code and just alter the fact to romani

 

menu channel {
-
  .Romani ( $+ %romani $+ )
  ..On:{ .enable #romani | set %romani On | echo $active 8,4-=[ romani On ]=- }
  ..Off:{ .disable #romani  | set %romani Off | echo $active 8,4-=[ romani Off ]=- }
}

#Romani on
on *:TEXT:*!romani*:*: { 
  if (%romani == off) halt
  set %posi $findtok($1-,$matchtok($1-,!romani,1,32),1,32) 
  var %svalue = $ [ $+ [ %posi ] ] 
  if (%svalue == !romani) { msg # Heres A Romani word For You $nick - $read(Gypsy/romani.txt) } 
  elseif (!romani isin %svalue) && (%svalue != !romani) && ($right(%svalue,-5) isnum) { 
  msg # Heres A Romani Word For You $nick - $read(Gypsy/romani.txt,$right(%svalue,-5)) } 
  set -u10 %romani off 
}

 

BUT: if I type !romani it will read the txt.doc at random ... but if I type !romani1 it will not read the 1st line of the txt.doc :(

Link to comment
Share on other sites

($right(%svalue,-5) isnum) needs to be ($right(%svalue,-7) isnum)

 

 

!fact is 5 characters

!romani is 7 characters

 

 

:lolwave: see I dont wear glasses and still missed that bit of the code :D ... nais tuke err0r ... do you knows of a good "Optician" :lmaojump:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...