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 

possible help for a one line script?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
notstrider
Voice


Joined: 30 Sep 2005
Posts: 3

PostPosted: Fri Sep 30, 2005 4:09 am    Post subject: possible help for a one line script? Reply with quote

Alright. Bear with me, I absolutely know nothing about Tcl scripting. I can't really make heads or tails of it. It's sad, I know. What I basically want to do is 'convert' a single line code from a mIRC script to Tcl.

The code is:

Code:
on 1:TEXT:cttl*:#chan:msg # $nick has $duration($calc((100 - $$2) / $$3),2) til next level -- STN!


Now, I've tried reading up on 'bind/pub', and I basically just get lost. Also the calc code is somewhat confusing me. Any help would be greatly appreciated. I'll try to read more about Tcl too. Thanks for helping out a 'newbie'.

Oh, also. The script does this -- If the user in #chan types 'cttl 19.82 .0005' (just an example), the bot will respond with 'user has 1hr 23minutes til next level -- STN!'. It's basically cheesy, but it's for myself and friends of mine that place a certain game, so this just determines when the next time we level up. Again, it's cheesy. heh.
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri Sep 30, 2005 5:35 am    Post subject: Reply with quote

Code:
bind pub - cttl cttl:calc

proc cttl:calc {nick uhost hand chan arg} {
  set arg [split $arg]
  set x [lindex $arg 0]
  set y [lindex $arg 1]
  if {[string is double -s $x] && [string is double -s $y]} {
    puthelp "PRIVMSG $chan :$nick has [duration [expr (100 - $x) / $y]] til next level -- STN!"
    return 1
  } else {
    puthelp "NOTICE $nick :you are too stupid to enter 2 floating point values!"
    return 0
  }
}

dont know if the calc is correct, since I dont know what to do with ",2"

PS: changed the script a little bit. I hope you have either the string map or the string is double inside, I almost forgot to ensure valid and safe evaluation. But with is double we also prevent causing any TCL errors... tcl errors always override errorInfo and therefore anyoing Very Happy.
_________________
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...


Last edited by De Kus on Fri Sep 30, 2005 5:54 am; edited 4 times in total
Back to top
View user's profile Send private message MSN Messenger
notstrider
Voice


Joined: 30 Sep 2005
Posts: 3

PostPosted: Fri Sep 30, 2005 5:45 am    Post subject: Reply with quote

it seems to be working well. thanks man. i appreciate it. if there is any issue with it, i'll be back. thanks again.
Back to top
View user's profile Send private message
notstrider
Voice


Joined: 30 Sep 2005
Posts: 3

PostPosted: Fri Sep 30, 2005 4:59 pm    Post subject: Reply with quote

haha. thanks again man. i really appreciate it. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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