This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

convert mirc script to tcl

Old posts that have not been replied to for several years.
User avatar
hikaro
Halfop
Posts: 68
Joined: Wed Mar 10, 2004 4:29 am

convert mirc script to tcl

Post by hikaro »

on Me:*:join:#channel:/play #channel story.txt 10000
on 1:PLAYEND:{ if (%q8 = 1) { /play #channel story2.txt 10000 | set %q8 2 } | else { /play #channel story.txt 10000 | set %q8 1 } }

pls anyone help me convert this, coz i really need the tcl thanks =)
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Don't assume everybody knows mIRC scripting.

Post by user »

What does it do?
Have you ever read "The Manual"?
User avatar
hikaro
Halfop
Posts: 68
Joined: Wed Mar 10, 2004 4:29 am

Post by hikaro »

it is for telling story to a channel so the script will read from story.txt and sopy to a channel line by line every 10 seconds
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

hikaro wrote:it is for telling story to a channel so the script will read from story.txt and sopy to a channel line by line every 10 seconds
Like this? (replace 'timer' with 'utimer', change the delay and call the proc with your channel name instead of a nick)
Have you ever read "The Manual"?
User avatar
hikaro
Halfop
Posts: 68
Joined: Wed Mar 10, 2004 4:29 am

Post by hikaro »

i have try it but i dont think it works/.. can u give me the proper code... like converting the mirc script that i typed.
i dont know much tcl script so pls help me...
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

hikaro wrote:i have try it but i dont think it works/.. can u give me the proper code... like converting the mirc script that i typed.
i dont know much tcl script so pls help me...
In what way does it not work? My suggestion would result in a script that does exactly what you asked for.
Have you ever read "The Manual"?
User avatar
hikaro
Halfop
Posts: 68
Joined: Wed Mar 10, 2004 4:29 am

Re: convert mirc script to tcl

Post by hikaro »

hikaro wrote:on Me:*:join:#channel:/play #channel story.txt 10000
on 1:PLAYEND:{ if (%q8 = 1) { /play #channel story2.txt 10000 | set %q8 2 } | else { /play #channel story.txt 10000 | set %q8 1 } }

pls anyone help me convert this, coz i really need the tcl thanks =)
can u just convert this script pls?
i really need this tcl, its for telling a story to channel repeatly. it will send line by line from story.txt in 10 seconds.
thx 8)
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Try this:

Code: Select all

bind join - * join:story
proc join:story {nick host hand chan} {
  global botnick
  if {$nick == $botnick} {
    slowmsg "story.txt"
  }
}

proc slowmsg {file {pos 0}} {
  set f [open $file]
  seek $f $pos
  if {[gets $f line]>-1} {
    putserv "privmsg #channel $line"
    utimer 10 [list slowmsg $file [tell $f]]
    } {
  }
  close $f
}
Hope it helps :P
Xpert.
User avatar
hikaro
Halfop
Posts: 68
Joined: Wed Mar 10, 2004 4:29 am

Post by hikaro »

xpert it got error... i just read one word not all the whole sentence.
<hikpalsu> KISAHKU
<hikpalsu> Kisah
<hikpalsu> demi
<hikpalsu> Aku
do u know where's the error??
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Replace:

Code: Select all

putserv "privmsg #channel $line"
to:

Code: Select all

putserv "privmsg #channel :$line"
:)
Xpert.
User avatar
hikaro
Halfop
Posts: 68
Joined: Wed Mar 10, 2004 4:29 am

Post by hikaro »

xpert it works!! but i want it repeat (loop) so when it gets to the last line it will go to the first line again.. can u add some code there pls
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

just add this line after "close $f"

Code: Select all

slowmsg "story.txt"
although this is a bad solution. i'd suggest you to read the file into memory instead of opening/closing it every time.

btw: i guess my first action in this chan would be to ignore the bot :mrgreen:
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Code: Select all

bind join - * join:story 
proc join:story {nick host hand chan} { 
  global botnick 
  if {$nick == $botnick} { 
    slowmsg "story.txt" 
  } 
} 

proc slowmsg {file {pos 0}} { 
  set f [open $file] 
  seek $f $pos 
  if {[gets $f line]>-1} { 
    putserv "privmsg #channel $line" 
    utimer 10 [list slowmsg $file [tell $f]] 
    } else {
    utimer 9 [list putserv "Re-reading the story:"]
    utimer 10 [list slowmsg $file]
  } 
  close $f 
}
Xpert.
User avatar
hikaro
Halfop
Posts: 68
Joined: Wed Mar 10, 2004 4:29 am

Post by hikaro »

it repeat line by line... not when they have reach last line go to first line
<Teraquad> 60
<Teraquad> 60
<Teraquad> 10
<Teraquad> 10
do u know why =(
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

have you tried my solution?

although it's bad (as noted) it should work.
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
Locked