mIRC Home    About    Download    Register    News    Help

Print Thread
#76710 25/03/04 11:58 PM
Joined: Mar 2004
Posts: 175
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2004
Posts: 175
First of all, I'm a first timer here but I know quite a bit in scripting. I'm making a Trading Card Game (TCG) and this scripts don't work. It's supposed to add cards to the persons deck.
------
on *:text:!add*:?: {
closemsg $nick
If (!$readini(registered.txt, n, Password, $nick)) { msg $nick You are not registered! Please type !register password | halt }
Elseif (!$readini(registered.txt, n, Login, $nick)) { msg $nick You have not logged into your account! Please type !login password | halt }
ElseIf (!$2-) { msg $nick You need to add the name of the card you want to add to your deck! | halt }
ElseIf (%player1 == $nick) { msg $nick You cannot add cards to your deck while you are dueling! | halt }
ElseIf (%player2 == $nick) { msg $nick You cannot add cards to your deck while you are dueling! | halt }
Elseif ($read(limited.txt, s, $2-)) && ($read(decks\ $+ $nick $+ .txt, s, $2-)) { msg $nick You already have 1 of this card in your deck! It is restricted to 1! | halt }
Elseif ($read(semilimited.txt, s, $2-)) && ($read(decks\ $+ $nick $+ .txt, s, $2-)) { semilimited }
(continues on, rest works)
------
Alias semilimited {
set %Counts 0
set %semilimited 0
:Start
Inc %Counts
If (!$Read(decks\ $+ $nick $+ .txt)) {
unset %semilimited
unset %Counts
halt
}
ElseIf (%semilimited == 2) {
msg $nick You already have 2 of this card in your deck! It is restricted to 2!
unset %semilimited
unset %Counts
halt
}
ElseIf ($Read(decks\ $+ $nick $+ .txt, %Counts != $2-)) { Goto Start }
ElseIf ($Read(decks\ $+ $nick $+ .txt, %Counts == $2-)) {
inc %semilimited
Goto Start
}
Else {
write decks\ $+ $nick $+ .txt $2-
msg $nick You have now added $2- to your deck!
unset %semilimited
unset %Counts
halt
}
}
------
The bolded text above are the ones that don't work. I have limited.txt and semilimited.txt in my main mIRC directory. I don't know what's wrong with it. It seems that its skipping that part of the script or something, because it doesn't halt the script when it finds that they match. Sorry for the long message :P


- Relinsquish
#76711 26/03/04 03:27 AM
Joined: Dec 2003
Posts: 199
K
Vogon poet
Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
It'd be nice to know where the error occurs at, That's quite a bit of coding to read thru.
-Mew


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
#76712 26/03/04 03:48 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
he said at the bottom it was the BOLD text that didnt work


Those who fail history are doomed to repeat it
#76713 26/03/04 04:18 AM
Joined: Mar 2004
Posts: 175
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2004
Posts: 175
It's supposed to halt when it finds the $2- in both limited.txt and decks\ $+ $nick $+ .txt but it doesn't. It continues with the script.


- Relinsquish
#76714 26/03/04 04:41 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
The s flag scans the file for a line beginning with <text> and returns the rest of line. Perhaps there's nothing for $read to return, and that's why your if condition fails?

If this is the case, you can use the w flag instead. This flag will scan the file and return an entire line.

#76715 26/03/04 09:09 PM
Joined: Mar 2004
Posts: 175
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2004
Posts: 175
thx, that helped me. How would I make it so that if it finds 2 of the $2- in decks\ $+ $nick $+ .txt and the $2- is in semilimited.txt, it would halt it. I'm currently trying to find out whats wrong. I'm not sure if the loop would be the best thing to use.


- Relinsquish
#76716 27/03/04 05:29 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Quote:
How would I make it so that if it finds 2 of the $2- in decks\ $+ $nick $+ .txt and the $2- is in semilimited.txt, it would halt it.

//filter -ff $+(decks\,$nick,.txt) nul $2- | if $filtered > 1 && $read(semilimited.txt,wn,$2-) { halt }

*NUL is a special system device which abandons anything you send to it. Since /filter requires an output window/file and since we don't need the output for this script (we only need the value of $filtered that tells us how many matches were found), we can safely use NUL.

#76717 28/03/04 03:25 AM
Joined: Mar 2004
Posts: 175
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2004
Posts: 175
I see... never tried out the filter command before. Thanks! I'll try it out right now.


- Relinsquish

Link Copied to Clipboard