Jump to content

What Is Wrong With This Code


Bloodyboss

Recommended Posts

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 ?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...