Skip to content
General IRCd

What Is Wrong With This Code

A TG007 community discussion started by Bloodyboss.

Discussion 6 posts
Page 1 of 1
Open
Topic #14593 · 6 published posts · 2,257 views

hey , I have this code in remote

 

on *:input:#:{

if ($1 == !msg) { timer 0 60 /amsg $!+ $!rand(1,12) $!read(wize.txt) }

}

 

it reads random lines from the file wize.txt I wanna a code that reads lines in order

 

X-Fusion helped me with this code

 

alias wize {

inc %wize.number

timer 0 60 amsg $rand(1,12) $read(wize.txt, $+ %wize.number $+ )

}

}

and in variables ( %wize.number 0 )

but when it works it keeps send the first line in the file wiz.txt to channel

 

I tried

alias wize {

inc %wize.number

timer 0 60 amsg $rand(1,12) $!read(wize.txt, $+ %wize.number $+ )

}

}

but also it sends the first line only

 

May anyone tells me what's wrong ?

Upvote

well you main problem is you have a bracket mismatch

 

alias wize {

inc %wize.number

timer 0 60 amsg $rand(1,12) $!read(wize.txt, $+ %wize.number $+ )

}

}

 

 

another problem is you would need to change the wize.number each time the timer triggers not just when u start the timer

 

what you are doing is inc the number once then starting a timer that will use that number every time

 

you could use another alias

alias wizestart { timer.wize 0 60 wize }
alias wize {
inc %wize.number
amsg $rand(1,12) $!read(wize.txt, $+ %wize.number $+ )
}

where you would start it with /wizestart

 

even then once it gets to be more than the lines of the txt file you will have an issue

 

you could start it over at one if the $read on the number didn't exist

Edited Aug 31, 2010 3:13 AM by err0r

Get information about ircWx here

So how would I change the number ???

 

could it be done by a code ??

alias wizestart { set %wize.number 0 | timer.wize 0 60 wize }
alias wize {
  inc %wize.number
  $iif(!$read(wize.txt,%wize.number),set %wize.number 1)
  amsg  $+ $rand(1,12) $read(wize.txt,%wize.number)
}

This would account for number of lines issue i mentioned above.

 

You would start it by /wizestart

Edited Aug 31, 2010 3:21 AM by err0r

Get information about ircWx here

yup it worked good - thank you err0r (Y)

you're welcome

Get information about ircWx here