Skip to content
MSN

on text

A TG007 community discussion started by Nimbus03.

Discussion 7 posts
Page 1 of 1
Open
Topic #2130 · 7 published posts · 661 views

hi i need some help

 

i’m making a dialog that takes two custom input commands like hello and bye and puts them a different .txt file in an on text or on action command like this:

 

on *:TEXT:*hello*:*:{ privmsg $chan bye }

or

on *:ACTION:*hello*:*:{ describe $chan bye }

 

but I’d rather have them in an .ini file set up like this :

 

0 hello 0 bye

or

1 hello 1 bye

 

meaning 0 for normal msgs and 1 for action msgs

but I don’t know how to make the code to bring them out of the .ini file from just saying the first word in the room, can someone help please

 

"the important thing was, that i had an onion on my belt, which was the style at the time"

Wouldn't really be much point in doing it exactly how you want. I'd suggest an alias.

alias textit { write -a file.txt on *:text:*hello*:#: $+ $chr(123) $pm(bye) $chr(125) }
alias actionit { write -a file.txt on *:action:*hello*:#: $+ $chr(123) $act(bye) $chr(125) }
alias pm { return .privmsg $chr(36) $+ chan $1- }
alias act { return .describe $chr(36) $+ chan $1- }

or something like that...

Edited Dec 7, 2004 4:27 PM by Cleric xtx

 

thx,

but i meant a list of words, there'd be a list in the .ini file, and when the first word was said in the room it'd say the second word on that same line

Edited Dec 7, 2004 5:56 PM by Nimbus03

"the important thing was, that i had an onion on my belt, which was the style at the time"

Oh now I get it!

on *:text:*:#:{
 var %a = 1
 while ($lines(file.txt) => %a) {
   if ($1- isin $gettok($read(file.txt,%a),1,94)) { privmsg $chan $gettok($read(file.txt,%a),2,94) | break }
   else { inc %a }
 }
}

Just use $chr(94) (aka ^) to seperate the "activator" word from the reply.

 

on *:text:*:#:{ tokenize 32 $strip($1-) | if ($ini(<inifile>,$1)) msg $chan $readini(<inifile>,$1) }
on *:action:*:#:{ tokenize 32 $strip($1-) | if ($ini(<inifile>,$1)) describe $chan $readini(<inifile>,$1) }

then load the ini file with this kind of thing..

hello=bye
bye=hello
one=two
first=second
blah=blahblah

 

i think that will work

Edited Dec 7, 2004 11:26 PM by vexation

bfush.PNG

thx cleric, it works great biggrin.gif,

but how can i get it to define whether the command is TEXT or ACTION in the way that i mentioned before with the 0 hello^1 bye thing?

 

thx again smile.gif

 

 

i just found a problem, it does the command when you only type just one letter, when it's meant to do it when you type the whole word or words, and i dunno how to fix this sad.gif, i hope you can hellp further

 

thx

Edited Dec 8, 2004 1:01 AM by Nimbus03

"the important thing was, that i had an onion on my belt, which was the style at the time"

ok i've figured it out now, got it all working just like i want smile.giftongue.gif

thx for all ya help cleric biggrin.gif

i couldn't get your idea to work vexation, but thx for helping anyway smile.gif

 

cheers guys cool.gif

"the important thing was, that i had an onion on my belt, which was the style at the time"