Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   getCommunityName(), getAccount() (https://forums.graalonline.com/forums/showthread.php?t=134257085)

cbk1994 11-27-2009 01:12 AM

getCommunityName(), getAccount()
 
getCommunityName(str account) - returns the community name of the player specified. Accepts either an account name or community name.

getAccount(str cname) - returns the account of the player specified. Accepts either an account name or community name.

It seems ridiculous that we're expected to adapt to community names without even basic functions like these available.

LoneAngelIbesu 11-27-2009 03:43 AM

findPlayer(account).communityname

findPlayerbyCommunityName(communityname).account


Is there any reason why these won't do? And why would you ever use getAccount(account) or getCommunityName(communityname)?

fowlplay4 11-27-2009 04:51 AM

Situations when the account is offline would make these handy, looks a little cleaner code-wise as well.

cbk1994 11-27-2009 06:31 AM

Quote:

Originally Posted by LoneAngelIbesu (Post 1540687)
findPlayer(account).communityname

findPlayerbyCommunityName(communityname).account


Is there any reason why these won't do? And why would you ever use getAccount(account) or getCommunityName(communityname)?

Absolutely. For example, a support center where you want to display the community name, a bank system where you can enter a community name to transfer money to the account (the same thing for adding to gangs, businesses, ...), staff account lookups, etc.

DustyPorViva 11-27-2009 06:46 AM

So does findplayer(account) work for old accounts and graal12345 accounts as well? If not, it should, as scripters shouldn't need to do constant checks between old accounts and new... and in that case:
findplayer(acc).displayacc or some other sort of short var that will return the name players desire to see(in the case of old accounts... the account, in the case of new accounts, the community name).

So simply: findplayer(account) should work seemlessly between the two account types. After all, new accounts still use a static account name in the form of graal12345, and scriptwise, as far as data concerns, scripters don't need the community name. In that case, findplayer(account).account should return either the old account name or the new graal123546 account(which is what scripters need for behind-the-scene stuff).

Display-wise, just an easy way to display the desired account to the player in the form of old account name or their community name, where graal12345 is undesirable(unless they have no community name, in which graal12345 should be substituted).

I haven't messed with community names much, so I'm not sure if these sort of things are already in place.

So ideally, if I were writing, say... a bank script, the best way I can think of to reflect all those changes would be as such:
PHP Code:

function onActionServerside(cmd) {
  if (
cmd == "deposit") {
    
temp.findnpc("BankDB");
    
temp.acc findplayer(params[1]).account;
    
n.(@ "stash_" acc) += params[2];
    
acc.chat "A total of " params[2] @ " has been deposited to the account of " acc.displayaccount;
  } 
}
//#CLIENTSIDE
function onPlayerchats() {
  if (
player.chat.starts("/deposit")) {
    
triggerserver("gui",name,"deposit",player.account,player.chat.substring(8));
  }


Which would always save the money to their static account(DustyPorViva or Graal123456, depending on when the account was made), but always display their community name when they deposit. That's how it should work, and would simply things a lot.

cbk1994 11-27-2009 07:09 AM

Quote:

Originally Posted by DustyPorViva (Post 1540706)
stuff

findPlayer() will accept an account name; old or new, they're still accounts

findPlayerByCommunityName() will accept an account name or community name; players with old accounts have their account as their community name

Let's assume "Graal123" has a cname of "Bob"
PHP Code:

// work:
temp.pl findPlayer("cbk1994");
temp.pl findPlayerByCommunityName("cbk1994");
temp.pl findPlayer("Graal123");
temp.pl findPlayerByCommunityName("Graal123");

// don't work:
temp.pl findPlayer("Bob"); 

The reason these commands are needed is not for findPlayer, but for when accounts are offline.

DustyPorViva 11-27-2009 07:15 AM

Quote:

Originally Posted by cbk1994 (Post 1540713)
findPlayer() will accept an account name; old or new, they're still accounts

findPlayerByCommunityName() will accept an account name or community name; players with old accounts have their account as their community name

Let's assume "Graal123" has a cname of "Bob"
PHP Code:

// work:
temp.pl findPlayer("cbk1994");
temp.pl findPlayerByCommunityName("cbk1994");
temp.pl findPlayer("Graal123");
temp.pl findPlayerByCommunityName("Graal123");

// don't work:
temp.pl findPlayer("Bob"); 

The reason these commands are needed is not for findPlayer, but for when accounts are offline.

I guess that makes sense if the only thing available is their community name... but why would you ever only have their community name available? However, I still think the script I posted above should work, as it seems pretty easy and with minimal effort on the scripters part.

cbk1994 11-27-2009 07:24 AM

Quote:

Originally Posted by DustyPorViva (Post 1540715)
I guess that makes sense if the only thing available is their community name... but why would you ever only have their community name available?

Commands players use, such as ":hire account", or even staff commands?

Quote:

However, I still think the script I posted above should work, as it seems pretty easy and with minimal effort on the scripters part.
Sure, that's not the problem. The problem arises when the other player is offline.

DustyPorViva 11-27-2009 07:34 AM

Quote:

Originally Posted by cbk1994 (Post 1540719)
Commands players use, such as ":hire account", or even staff commands?

True points. I agree, this is a mess for scripters. I hate having to do checks like this.

Quote:

Originally Posted by cbk1994 (Post 1540719)
Sure, that's not the problem. The problem arises when the other player is offline.

What about them being offline? As far as I know, findplayer() does not allow access to an offline player data anyways?

cbk1994 11-27-2009 07:36 AM

Quote:

Originally Posted by DustyPorViva (Post 1540722)
What about them being offline? As far as I know, findplayer() does not allow access to an offline player data anyways?

Yes, but bank accounts are usually stored in a database NPC, SQL, etc.

DustyPorViva 11-27-2009 07:49 AM

Quote:

Originally Posted by cbk1994 (Post 1540723)
Yes, but bank accounts are usually stored in a database NPC, SQL, etc.

Ah, ya, I get it now. Same conditions of :hire account thing.

What a mess.

Admins 11-27-2009 01:49 PM

It could be added somehow although the call might need to be blocking (like waitfor()) since it might need to contact the serverlister / accounts database.

cbk1994 11-28-2009 12:25 AM

Quote:

Originally Posted by Stefan (Post 1540783)
It could be added somehow although the call might need to be blocking (like waitfor()) since it might need to contact the serverlister / accounts database.

Well, if we're expected to transition to community names, these kind of functions are definitely needed. I can't imagine it's too hard to avoid the waitfor scope loss, but I don't know the details of it.

xXziroXx 11-28-2009 12:33 AM

Quote:

Originally Posted by cbk1994 (Post 1540719)
Commands players use, such as ":hire account", or even staff commands?

Chat commands should be eliminated completely. Only time they should exist is as a secondary way of triggering functions that are already available in some kind of GUI.

cbk1994 11-28-2009 01:50 AM

Quote:

Originally Posted by xXziroXx (Post 1540881)
Chat commands should be eliminated completely. Only time they should exist is as a secondary way of triggering functions that are already available in some kind of GUI.

There are still plenty of cases where you may only know the community name.

http://img213.imageshack.us/img213/6...91127at650.png


All times are GMT +2. The time now is 02:52 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.