mIRC Home    About    Download    Register    News    Help

Print Thread
#135167 09/11/05 02:09 AM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
Joined: Sep 2005
Posts: 53
This is what I have
Code:
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:
Code:
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.
#135168 09/11/05 02:19 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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.

Code:
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

Code:
On *:Text:!Commands:#: {
   play -n $nick commands.txt 1000
}

-Andy

#135169 09/11/05 02:29 AM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
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.
#135170 09/11/05 02:33 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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

#135171 09/11/05 02:40 AM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
Joined: Sep 2005
Posts: 53
Soo it would be
Code:
On *:Text:?: {
if (!$readini(writeini Game.ini Users $nick $true))
blah blah

??

#135172 09/11/05 02:42 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Nope.

Code:
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

#135173 09/11/05 02:51 AM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
Joined: Sep 2005
Posts: 53
And one last thing:
Code:
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.

#135174 09/11/05 03:29 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
On second thoughts, use txt files instead of INI.

Code:
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

#135175 09/11/05 08:52 PM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
Joined: Sep 2005
Posts: 53
The !Start works fine but the !chr * Doesnt.
It skips the whole step and says "You arent registered".

#135176 09/11/05 09:05 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Try changing:

Code:
  if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {


to:

Code:
  if ($isfile($+(Naruto RPG\,$nick,.stats,.txt))) {


So you're left with..

Code:
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

#135177 09/11/05 09:18 PM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
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.

#135178 09/11/05 09:28 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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

#135179 09/11/05 09:34 PM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
Joined: Sep 2005
Posts: 53
I need a code to show someones Stats. This is what i have but it doesnt work.
Code:
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.
#135180 09/11/05 10:50 PM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
Joined: Sep 2005
Posts: 53
Now that I changed the
Code:
if (!$isfile($+(Naruto RPG\,$nick,.stats,.txt))) {

To
Code:
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.

#135181 09/11/05 11:17 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
This is what I have, works for me..

Code:
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 &lt;= $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

#135182 10/11/05 01:16 AM
Joined: Sep 2005
Posts: 53
C
Babel fish
OP Offline
Babel fish
C
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.

#135183 10/11/05 01:41 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Try..

Code:
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


Link Copied to Clipboard