mIRC Home    About    Download    Register    News    Help

Print Thread
need help with script to read from text file #266296 07/11/19 05:51 PM
Joined: May 2013
Posts: 112
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 112
A found a raffle script and want to modify it but have trouble in doing so. Once the raffle is set up users can draw a ticket to enter. That part works perfectly for all users.

I want to at times restrict drawing tickets to selected users by checking their nicks against a text file. Something is not working as the script every time returns that he does not qualify.
Must be something to do with reading the text file or maybe brackets or the script. Please help. The fiist portion of the script for all users works perfectly.


.
Quote

;All nicks======================================
on *:text:*!ticket*:#: {
if ($1 == %c $+ !ticket) {
if (%raffle.join. [ $+ [ $nick ] ] == 1) {
msg $chan $nick You already bought a ticket from %raffler $nick wait for someone else to hold a new raffle and then buy a ticket from him. | halt }
if (%raffle == 0) {
msg $chan $nick Sorry $nick no open raffle at the moment. Try again later.
msg $chan $nick 12 $nick You can start your own raffle. Type /information for instructions. | halt }
else {
if ($nick == %raffler) {
msg $chan $nick 4 No no.. $nick you can't enter your own raffle. | halt }
if (%raffle == 1) {
set %raffle.join. [ $+ [ $nick ] ] 1
msg $chan $nick 12 %raffler You have successfully entered in the current raffle. Wait until the %raffler ends the entry session to find out if you are receiving a prize. | .write txt\raffle.txt $nick $+ ! | halt }
}
}
}


Adapted to check against text file not working

[quote]
;Selected nicks from textfile======================================
on *:text:*!ticketa*:#: {
if ($1 == %c $+ !ticketa) {
if (%raffle.join. [ $+ [ $nick ] ] == 1) {
msg $chan $nick You already bought a ticket from %raffler $nick wait for someone else to hold a new raffle and then buy a ticket from him. | halt }
if (%raffle == 0) {
msg $chan $nick Sorry $nick no open raffle at the moment. Try again later.
msg $chan $nick 12 $nick You can start your own raffle. Type /information for instructions. | halt }
else {
if ($nick == %raffler) {
msg $chan $nick 4 No no.. $nick you can't enter your own raffle. | halt }
if (%raffle == 1) {
var %foundInTheList = $read(Docs\register.txt, w, $2)
if (%foundInTheList) {
set %raffle.join. [ $+ [ $nick ] ] 1
msg $chan $nick 12 %raffler oorhandig jou kaartje. 2 Good luck. 12 Wag tot ek die wenner trek om uit te vind wie gewen het. Ek of 'n Ops sal jou natuurlik ook kontak. | .write docs\raffle.txt $nick $+ ! | halt }
else { msg $chan 12Sorry $nick you do not qualify for this special raffle. | halt }
}
}
}
}
[/quote

Any help will be appreciated. If you need the full script then I will add it

Re: need help with script to read from text file [Re: raycomp] #266297 07/11/19 05:53 PM
Joined: May 2013
Posts: 112
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 112
ooops sorry quotes incorrect

Re: need help with script to read from text file [Re: raycomp] #266301 08/11/19 05:47 PM
Joined: May 2013
Posts: 112
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 112
Closed some friendly person in another forum was prepared to help me out....