mIRC Home    About    Download    Register    News    Help

Print Thread
Oh my god, I feel like a n00b. #123555 25/06/05 12:25 AM
Joined: Jun 2005
Posts: 30
_
_DuDe_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Jun 2005
Posts: 30
Ok, I am like so getting everything wrong on this script. This time I made a section that when the user types !battlefield, it will show all the users.

Code:
on *:TEXT:!battlefield*:*:{
  if ($2 != $null) {
    /msg $nick  $+ $2 $+ 's $+  Gold is: $readini( $2 $+ .ini, THINGS, gold) | /msg $nick  $+ $2 $+ 's $+  Strike is: $readini( $2 $+ .ini, THINGS, Strike) | /msg $nick  $+ $2 $+ 's $+  Defense is: $readini( $2 $+ .ini, THINGS, Defense)
  }
  if ($2 == $null) {
    /msg $nick Players: $readini( players.ini, USERS, NICKS ) 
  }
}


Please feel free to write a better version, as I can't seem to get this right. It makes me mad, because I had it all working, then I decided to make it Multi player, cause facing my self was not fun, and now I seem to have forgotten what an mIRC script is.

Please Help Me.

~_DuDe~

Re: Oh my god, I feel like a n00b. #123556 25/06/05 02:52 AM
Joined: Jun 2005
Posts: 16
T
tyler22 Offline
Pikka bird
Offline
Pikka bird
T
Joined: Jun 2005
Posts: 16
u r no noob i got lost in that script i wish i could help u but im a real noob


-tyler
Re: Oh my god, I feel like a n00b. #123557 25/06/05 03:28 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
maybe you could show the command you use to add a user?
My guess is you are replacing the nicks data with the new nick, not adding to it.

alias addnicks {
var %nicks = $readini(players.ini, users, nicks) $$1
writeini players.ini users nicks %nicks
}
useage /addnicks (nick you want to add)

removing a nick might look like this

alias remnicks {
var %nicks = $remove( $readini(players.ini, users, nicks), $$1)
writeini players.ini users nicks %nicks
}
useage /remnicks (nick you want to remove)

I did not test this, but should work

Re: Oh my god, I feel like a n00b. #123558 25/06/05 03:55 AM
Joined: Jun 2005
Posts: 30
_
_DuDe_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Jun 2005
Posts: 30
I have it on creation of a user account, | writeini players.ini USERS NICKS $2 | is one of the things it does.

That section of the script is as follows.

Code:
on *:TEXT:!create*:*:{
  if ( $2- == $null ) { /msg $nick To create an account please type !create <nick> <pass> }
  if ( $2 == $null ) && ( $3- != $null ) { /msg $nick Please enter a valid nickname }
  if ( $2 != $null ) && ( $3- == $null ) { /msg $nick Please enter a valid password }
  if ( $2- != $null ) { writeini players.ini USERS NICKS $2 | writeini $nick $+ .ini NICK USER $2 | writeini $nick $+ .ini NICK PASS $3- | writeini $nick $+ .ini THINGS GOLD 10000 | writeini $nick $+ .ini THINGS UP 1 | writeini $nick $+ .ini THINGS SA 0 | writeini $nick $+ .ini THINGS DA 0 | writeini $nick $+ .ini THINGS strike 1000 | writeini $nick $+ .ini THINGS defense 1000 | writeini $nick $+ .ini THINGS soldiers 10 | writeini $nick $+ .ini THINGS excalibur 0 | writeini $nick $+ .ini THINGS dragonskin 0 | writeini $nick $+ .ini THINGS shield 0 | writeini $nick $+ .ini THINGS sword 0 | /msg $nick Your registration was sucessfull. }
}

Re: Oh my god, I feel like a n00b. #123559 25/06/05 03:58 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
writeini players.ini USERS NICKS $2
that would overwrite whatever nick was in the ini, right?
/run notepad players.ini
take a look

Re: Oh my god, I feel like a n00b. #123560 25/06/05 04:01 AM
Joined: Jun 2005
Posts: 30
_
_DuDe_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Jun 2005
Posts: 30
Lmao, yes it is. OoPs.

Re: Oh my god, I feel like a n00b. #123561 25/06/05 04:24 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
k, just for fun add this alias
Code:
alias addnicks {
var %nicks = $readini(players.ini, users, nicks) $$1
writeini players.ini users nicks %nicks
}
; change the add line you have now to use the alias:

if ( $2- != $null ) { [color:red]addnicks[/color] $2 | writeini $nick $+ .ini NICK USER $2 | writeini $nick $+ .ini NICK PASS $3- | writeini $nick $+ .ini THINGS GOLD 10000 | writeini $nick $+ .ini THINGS UP 1 | writeini $nick $+ .ini THINGS SA 0 | writeini $nick $+ .ini THINGS DA 0 | writeini $nick $+ .ini THINGS strike 1000 | writeini $nick $+ .ini THINGS defense 1000 | writeini $nick $+ .ini THINGS soldiers 10 | writeini $nick $+ .ini THINGS excalibur 0 | writeini $nick $+ .ini THINGS dragonskin 0 | writeini $nick $+ .ini THINGS shield 0 | writeini $nick $+ .ini THINGS sword 0 | /msg $nick Your registration was sucessfull. }

Re: Oh my god, I feel like a n00b. #123562 25/06/05 08:19 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
writeini players.ini USERS NICKS $2


Shouldnt this be
writeini players.ini USERS NICKS $nick
????

Re: Oh my god, I feel like a n00b. #123563 25/06/05 11:52 AM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Quote:
removing a nick might look like this

alias remnicks {
var %nicks = $remove( $readini(players.ini, users, nicks), $$1)
writeini players.ini users nicks %nicks
}
useage /remnicks (nick you want to remove)


That's not a brilliant way of doing it because if "MikeChat" and "Mike" were both in the nickname list and you wanted to remove "Mike", "MikeChat" would be changed to just "Chat"

I'd use something like this:

Code:
alias addnick { writeini players.ini users nicks $addtok($readini(players.ini,users,nicks),$?1="Who would you like to add?",32) }
alias remnick { writeini players.ini users nicks $remtok($readini(players.ini,users,nicks),$?1="Who would you like to remove?",1,32) }


New username: hixxy
Re: Oh my god, I feel like a n00b. #123564 25/06/05 03:24 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:

Shouldnt this be
writeini players.ini USERS NICKS $nick


didnt he have the nick as a required parameter?
if ( $2- == $null ) { /msg $nick To create an account please type !create <nick> <pass> }

Re: Oh my god, I feel like a n00b. #123565 25/06/05 03:32 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:

That's not a brilliant way of doing it because if "MikeChat" and "Mike" were both in the nickname list and you wanted to remove "Mike", "MikeChat" would be changed to just "Chat"


you are right, also he has <password> going in the add section and I didn't look to see where that is handled.

In any case the adding of nicks to the ini was overwriting whatever was there before and I hope all of this has steered him on to working that part out.

Re: Oh my god, I feel like a n00b. #123566 26/06/05 12:24 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
didnt he have the nick as a required parameter?
if ( $2- == $null ) { /msg $nick To create an account please type !create <nick> <pass> }


I asked becuase after "meaning to add" $2 as the nick to the list of nicks he then does these writeini $nick $+ .ini , so i assummed he would be using $2 $+ .ini

Maybe im wrong, thats why i asked?

Re: Oh my god, I feel like a n00b. #123567 26/06/05 01:29 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
oh, well I was just thinking of the art that wasn't working