|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
This is what I have
on *:Text:!Start:?: {
if ($nick != %member.$nick) {
set $+(%,member.,$nick)
/msg $nick You're Journey Is About To Begin, But Before That Lets Get You Registered.
/msg $nick You need to choose your character. To see the list of characters type !chrs and to choose one type !chr <Name>
}
else ($nick = %member.$nick) { msg $nick You have already registered } { halt }
}
Im trying to make it so if someone already pressed !Start they cant press it again. It keeps saying "$nick No such nick/channel" and shows the msg even though the person on the list. And in another script I have many lines to Notice and it lags alot, does $timer help slow the lagging, if so how can it be used in a script like like this but bigger:
on *:Text:!Commands:#: {
/notice $nick Commands
/notice $nick !Join
/notice $nick Other Commands
/notice $nick !Signin
}
Last edited by CraZyHanD; 09/11/05 02:18 AM.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
1. I reckon the best way to store nicknames in games are by INI files or hash tables. Vars can get very messy.
On *:Text:!Start:?: {
if (!$readini(Game.ini,Users,$nick)) {
writeini Game.ini Users $nick
msg $nick You're Journey Is About To Begin, But Before That Lets Get You Registered.
msg $nick You need to choose your character. To see the list of characters type !chrs and to choose one type !chr <Name>
}
else { msg $nick You have already registered. }
}
2. Creat a file called commands.txt in your mIRC folder and play the file to them
On *:Text:!Commands:#: {
play -n $nick commands.txt 1000
}
-Andy
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
Err.. yea but then this message shows up:
* /writeini: insufficient parameters (line 4, Naruto RPG) - $nick No such nick/channel -
Last edited by CraZyHanD; 09/11/05 02:30 AM.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
That writeini is a mistake on my part.
It should be:
writeini Game.ini Users $nick $true
- $nick No such nick/channel -
Is a mistake on your side somewhere, maybe two !Start scripts.
-Andy
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
Soo it would be
On *:Text:?: {
if (!$readini(writeini Game.ini Users $nick $true))
blah blah
??
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Nope.
On *:Text:!Start:?: {
if (!$readini(Game.ini,Users,$nick)) {
writeini Game.ini Users $nick $true
msg $nick You've just registered.
}
else { msg $nick You have already registered. }
}
-Andy
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
And one last thing:
on *:Text:!Chr *:?: {
var %ans = $2
if (%ans = Sasuke) {
set $+(%,chr.,$2)
set $+(%,Lvl1.,1)
set $+(%,atk1.,6)
set $+(%,def1.,4)
set $+(%,spd1.,6)
/msg $nick You have chosen $2 as your character.
/msg $nick To view Sasuke's attacks type !Attacks
}
if (%ans = Sakura) {
set $+(%,chr.,$2)
set $+(%,Lvl2.,1)
set $+(%,atk2.,6)
set $+(%,def2.,4)
set $+(%,spd2.,6)
/msg $nick You have chosen $2 as your character.
/msg $nick To view Sakura'a attacks type !Attacks
}
else { You already chose a character }
}
}
How should I set this in an Ini file and how can I stop it if someone already typed !chr whatever.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
On second thoughts, use txt files instead of INI.
On *:Text:!Start:?: {
if (!$isdir(Naruto RPG)) mkdir "Naruto RPG"
if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
write $+("Naruto RPG\,$nick,.stats,.txt")
}
else { msg $nick You are already registered. }
}
on *:Text:!Chr *:?: {
if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
var %do.cmd = write $+("Naruto RPG\,$nick,.stats,.txt")
if ($2 == Sasuke) {
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sasuke's attacks type !Attacks
}
if ($2 == Sakura) {
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sakura'a attacks type !Attacks
}
else { msg $nick You already chose a character }
}
else { msg $nick You aren't registered. }
}
I've added both codes so all you got to do is replace. -Andy
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
The !Start works fine but the !chr * Doesnt. It skips the whole step and says "You arent registered".
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Try changing:
if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
to:
if ($isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
So you're left with..
on *:Text:!Chr *:?: {
if ($isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
var %do.cmd = write $+("Naruto RPG\,$nick,.stats,.txt")
if ($2 == Sasuke) {
write -c $+("Naruto RPG\,$nick,.stats,.txt")
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sasuke's attacks type !Attacks
}
if ($2 == Sakura) {
write -c $+("Naruto RPG\,$nick,.stats,.txt")
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sakura'a attacks type !Attacks
}
}
else { msg $nick You aren't registered. }
}
-Andy
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
No, that didnt work but I found one thing out. By skipping the first part ( !Start ) and going to the second ( !Chr * ) it works fine. So if the file is already created then it goes to the Else message.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
This is what happens for me:
[14:26] <Andy18> !chr Sasuke [14:26] <SladeKraven> You aren't registered. [14:26] <Andy18> !Start [14:26] <Andy18> !chr Sasuke [14:26] <SladeKraven> You have chosen Sasuke as your character. [14:26] <SladeKraven> To view Sasuke's attacks type !Attacks
You'd need to add some sort of comfirmation when thet type !Start so it messages them.
-Andy
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
I need a code to show someones Stats. This is what i have but it doesnt work.
on Naruto:Text:!Stats:?: {
if ($nick isin (Naruto_RPG\,$nick,.stats,.txt)) {
play -n $nick Naruto_RPG\,$nick,.stats,.txt
}
}
Last edited by CraZyHanD; 09/11/05 10:38 PM.
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
Now that I changed the
if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
To
if ($isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
Its messed up. Someone can type !Chr Sasuke or Sakura as many times as they want and it keep making the File bigger.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
This is what I have, works for me..
On *:Text:!Start:?: {
if (!$isdir(Naruto RPG)) mkdir "Naruto RPG"
if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
write $+("Naruto RPG\,$nick,.stats,.txt")
write $+("Naruto RPG\,Users.dat") $nick
msg $nick Your journey is about to start.
}
else { msg $nick You are already registered. }
}
on *:Text:!Chr *:?: {
if ($isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
var %do.cmd = write $+("Naruto RPG\,$nick,.stats,.txt")
if ($2 == Sasuke) {
write -c $gettok(%do.cmd,2-,32)
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sasuke's attacks type !Attacks
}
if ($2 == Sakura) {
write -c $gettok(%do.cmd,2-,32)
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sakura'a attacks type !Attacks
}
}
else { msg $nick You aren't registered. }
}
On *:Text:!Stats:?: {
if ($read("Naruto RPG\Users.dat",w,$nick)) {
var %x = 1
while (%x <= $findfile("Naruto RPG",*.txt,0)) {
var %file = $findfile("Naruto RPG",*.txt,%x)
msg $nick $+(%x,.) $gettok($gettok(%file,$numtok(%file,92),92),1,46)
inc %x
}
}
}
-Andy
|
|
|
|
Joined: Sep 2005
Posts: 53
Babel fish
|
OP
Babel fish
Joined: Sep 2005
Posts: 53 |
That script works perfectly but for 2 things. 1) $Nick can type !Chr Sasuke again and again. 2) The !Stats commands should read or play the $nick.stats not the User.dat file.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Try..
On *:Text:!Start:?: {
if (!$isdir(Naruto RPG)) mkdir "Naruto RPG"
if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
write $+("Naruto RPG\,$nick,.stats,.txt")
msg $nick Your journey is about to start.
}
else { msg $nick You are already registered. }
}
on *:Text:!Chr *:?: {
if ($isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
var %do.cmd = write $+("Naruto RPG\,$nick,.stats,.txt")
if (!$read($+(Naruto RPG\,$nick,.stats,.txt),w,*Character:*)) {
if ($2 == Sasuke) {
write -c $gettok(%do.cmd,2-,32)
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sasuke's attacks type !Attacks
}
if ($2 == Sakura) {
write -c $gettok(%do.cmd,2-,32)
%do.cmd Character: $2
%do.cmd Level: 1
%do.cmd Attack: 6
%do.cmd Defence: 4
%do.cmd Speed: 6
msg $nick You have chosen $2 as your character.
msg $nick To view Sakura'a attacks type !Attacks
}
}
else { msg $nick You already chose $gettok($read($+(Naruto RPG\,$nick,.stats,.txt),w,*Character:*),2,32) as your character.
}
}
else { msg $nick You aren't registered. }
}
On *:Text:!Stats:?: {
if ($isfile($+(Naruto RPG\,$nick,.stats,.txt))) {
play $nick $+("Naruto RPG\,$nick,.stats,.txt") 1000
}
}
-Andy
|
|
|
|
|