world/New()
..()
if(fexists("accounts.sav"))
var/savefile/f=new("accounts.sav")
f>>clients
var/list/clients=list()
client
var/savefile/path
proc
check_save()
if(!path)
path=new("clients/[ckey].sav")
save()
check_save()
if(mob.account)
path[mob.account]<<mob
load(var/v)
check_save()
if(v in path.dir)
path[v]>>mob
New()
..()
winshow(src,"login",1)
winshow(src,"register",0)
winshow(src,"buddylist",0)
winshow(src,"chat",0)
Del()
save()
..()
account
var/password
var/name
var/list/buddies
New(n, p)
if(n in clients)return
src.name=n
src.password=p
clients.Add(src.name=src.password)
mob
Write(var/savefile/F)
if(!clients.Find(src.account))
clients.Add(src.account)
var/savefile/f=new("accounts.sav")
f<<clients
..()
var/account/account
verb
login()
var/account_name=winget(src,"loginusername","text")
var/account_password=winget(src,"loginpassword","text")
if(account_name in clients && clients[account_name]==account_password)
src.client.load(account_name)
src.account=clients.Find(account_name)
alert(src,"this worked")
register()
winset(src,"loginbutton","is-visible=false")
winset(src,"registerbutton","is-visible=false")
winset(src,"finishbutton","is-visible=true")
finish()
var/account_name=winget(src,"loginusername","text")
var/account_password=winget(src,"loginpassword","text")
if(account_name in clients)return
account.New(src, account_name, account_password)
src.client.save()
winset(src,"loginbutton","is-visible=true")
winset(src,"registerbutton","is-visible=true")
winset(src,"finishbutton","is-visible=false")
Problem description:
Okay this is what I'm trying to do. When people login they use their username and password to enter. If they don't have one they hit register and make one. When accounts are made they are added to a list along with the password. Then they can login to this account without others being able to use the same username.
The problem I am having is, nothing seems to work. When registering when you hit the finish button nothing happens. I switched it up some and got it to at least change the buttons, but that wasn't really doing anything I needed it to so I switched it back. Then logining in also doesn't work it can't seem to find the clients list or something. I even hard coded some fake accounts with passwords and it still doesn't work.
I'm not sure what I am doing wrong. The way I am saving and loading the account is like so.
New account is created
Add new account to list so it would be like- clientslist(accountname=accountpassword)
Then load the account by checking if the account name is in the list and if it equals the password.
If so load the mob the account was used for. This loads their variables, and buddies.
I am not doing something right though. I just don't understand what.
You have similar issues confusing text and objects elsewhere. For example, you are searching clients for account_name, but clients only have /account objects and account_name is a text string.
You are also calling the New() proc directly. This should not be done and honestly should result in a compiler error. New() is automatically called by using the new() statement, and so is used for initializing new objects. Calling it otherwise defeats its purpose.