mIRC Home    About    Download    Register    News    Help

Print Thread
#252307 02/04/15 08:36 PM
Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
Code:
on *:text:*!MyName*:#MyRoom: {
  if ($2 == $readini($nick $+ .chr,pass,pass)) 
  if ($3 == $readini($nick $+ .chr,name,name)) 
  else notice $nick Wrong information. This is not the name for ($readini($nick $+ .chr,name)



I have the rest of my script working except this part.. I think the two "if's" are the issue. I hope to use this script to give people access to their stored information if their pass and name match those stored in the file.

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
You're missing something, I can't really tel what you're intending to do, but try this

Code:
on *:text:*!MyName*:#MyRoom: {
  if ($2 == $readini($nick $+ .chr,pass,pass)) && ($3 == $readini($nick $+ .chr,name,name)) { DO STUFF }
else notice $nick Wrong information. This is not the name for ($readini($nick $+ .chr,name)

Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
Code:
on *:text:*!Login*:#MyRoom: {
  if ($2 == $readini($nick $+ .chr,pass,pass)) && ($3 == $readini($nick $+ .chr,name,name)) { 
    writeini $nick $+ .chr pass passaccept on
    notice $nick You have logged in!
  mode #LATOOC +v $nick  }
  else notice $nick Wrong information. This is not the information for $3
  halt
}


And it just keeps saying

<Bot> Wrong information. This is not the information for CharacterName

I'm not sure it's even reading the .chr properly

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Yea, your $readini looks a bit strange. It should be something similar to this.

if ($readini(Characters.ini,n,$nick,pass) == $2) && ($readini(Characters.ini,n,$nick,name) == $3) { ... }

Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
It's not an ini file, it's a .chr file that reads like an ini or txt. There's no character.ini but instead, a file based on the character name ($nick if they're logging in on their nickname) or ($3 if they're logging in with their character name, on a different nickname)

So they can go
!login password charactername
And get logged in, even on another nickname.
The file works for every other script and snippet I have except this one.

In this code, the nickname and character name is Misk. But I'd like to login to Misk's information through a different nickname like Misk-CardShop or whatever it happens to be.
Code:

[pass]
pass=Kookame
[#MyRoom~Misk]
Name=Misk
Register=on



Last edited by Kooky; 03/04/15 12:18 AM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Extensions are irrelevant, that's an ini file.

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
I'm a bit confused why you do it like that. Can't you just use this structure?

Code:

[Misk]
pass=Kookame
chan=#MyRoom~Misk
Register=on


To check if login was correct:

if ($readini(Characters.ini,n,$3,pass) == $2) { ... }



Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
No, because I spent months working on my coding skills and understanding to get to use .chr files for the characters. A single character.ini won't hold some 50+ characters with all of their spells, items, equips, notes, quirks, stats... so I use a file per character. The login info is directly linked on the .chr file. I could make a separate login file for a character list I guess...

Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
Originally Posted By: Loki12583
Extensions are irrelevant, that's an ini file.


I get that it functions like one, but what I'm saying is I use different files per character and need it to match the character name, not a single file to house all login information. But I'm considering that now.


Link Copied to Clipboard