egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

>> Simple MIRC -> TCL Script Conversion <<

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Hamish
Voice


Joined: 27 Mar 2006
Posts: 25

PostPosted: Thu Mar 30, 2006 3:27 am    Post subject: >> Simple MIRC -> TCL Script Conversion << Reply with quote

I need a script that will allow the user to type !price item
The script should get the item from this text file Pricelist and return the line that word is contained on.

Eg. user types !price Abyssal whip and the bot will search the text file and return line one of the text file "Abyssal whip: 2.9-3.2Mil" as a notice to the user... So it's like:

<@Hamish> !price Abyssal whip
-ClanBot- Abyssal whip: 2.9-3.2Mil

Also, if it helps at all, here is the MIRC version:
Code:
on *:TEXT:!price*:#:{
    .notice $nick *** [7 $upper($$2-) ]: $read(prices.txt, s, $$2- $+ :)
  }
}

_________________
Thanks, Hamish.
Back to top
View user's profile Send private message Send e-mail
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Thu Mar 30, 2006 9:39 pm    Post subject: Reply with quote

something like that should do the trick:
Code:
bind pub - !price prices

proc prices {nick uhost hand chan text} {
   set hit 0
   set fd [open prices.txt r]
   while {![eof $fd]} {
      if {[string match -nocase "$text: *" [set price [gets $fd]]]} {
         set hit 1
         break
      }
   }
   close $fd
   if {$hit} {
       puthelp "NOTICE $nick :$price"
       return 1
   } else {
       puthelp "NOTICE $nick :No match found"
       return 0
   }
}

Read TCL manual for possible wildcard searchs.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
Hamish
Voice


Joined: 27 Mar 2006
Posts: 25

PostPosted: Fri Mar 31, 2006 11:40 am    Post subject: Reply with quote

De Kus, it works perfectly, thanks alot man! Very Happy
_________________
Thanks, Hamish.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber