HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [resolved] Online DB only?  (Read 132 times)

Thazager

  • General Accounts
  • *
  • Posts: 1093
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
[resolved] Online DB only?
« on: Oct 07, 17, 12:52:23 AM »

Working on making 2 messages, 1 for players that are "not" in the database, and 1 for players that are but currently "offline".
How does one know the difference?


I have found that all functions seem to access only the players online, not any of the accounts that exist with chars and names in them.  The function is C++ only as to whether the name can be used or not.

Code: [Select]
external function UpdateCharacterName( character as NodeRef, newName as String ) as Boolean

I was hoping something like $WORLD._knownPlayers or $WORLD._knownNames would be able to give a list, but those are the "online" only functions.

This only checks the online players. If they are not online it returns 0, it also returns 0 if they don't exist. So, no idea which they are.

Code: [Select]
  playerID as ID = $WORLD._FindPlayerByName(player)

This is about the same thing, it only works if the player is online. It cant tell if the player is offline or does not exist.

Code: [Select]
  if not($WORLD._IsPlayerOnline( playerID ))

This function (by the way it looks) should give all names, but it only gives info for the ones "online".

Code: [Select]
//  In E_WorldClassMethods (server)

remote method getPlayerBase()
  value1 as LookupList indexed by ID of Class _KnownPlayerData = $WORLD._knownPlayers
  $CHAT.ChatWorld("","amount of IDs "+value1.length)

  foreach val in value1
    $CHAT.ChatWorld("","ID: "+val)
  .

  value2 as LookupList indexed by String of ID = $WORLD._knownNames
  $CHAT.ChatWorld("","amount of names "+value2.length)

  foreach val in value2
    $CHAT.ChatWorld("","name: "+val)
  .
.

« Last Edit: Oct 16, 17, 07:15:50 PM by Thazager »
Logged
Heroes and Villains Lead programmer/scripter
Exile Online Lead programmer/scriptor

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: Online DB only?
« Reply #1 on: Oct 07, 17, 01:05:41 AM »

A better approach would be to make a message queue that when a player connects they check to see if there are any new messages for the "world" and then create it on the fly.

This way you only need to store a slug on the account node for what version of message they are and produce all messages thereafter.
« Last Edit: Oct 07, 17, 01:07:39 AM by nocake »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1093
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Online DB only?
« Reply #2 on: Oct 07, 17, 01:10:37 AM »

this message is for the player sending invites, perhaps by in game mail or to a guild, and they would get the feedback that the player was not online (meaning they would get the invite later) or that they don't exist (meaning they might have misspelled the name).
Logged
Heroes and Villains Lead programmer/scripter
Exile Online Lead programmer/scriptor

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: Online DB only?
« Reply #3 on: Oct 07, 17, 01:54:27 AM »

This is usually why you cant message someone online or not on your friends list in a game. I am sure other games have a solution now but just stick with keeping it simple. Make them add the friend first then get the id from that.

You wouldnt really want the player sending invites and messages to those they are not aware of in some way already imo.
« Last Edit: Oct 07, 17, 01:56:54 AM by nocake »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1093
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Online DB only?
« Reply #4 on: Oct 11, 17, 01:51:31 PM »

Found something that sounds promising, and seems to be working how we need it.

// Returns the account ID for the account root node that owns a character root node with the CHARACTERNAME.
//   This works in any area-instance, whether the account is loaded or not.
external function LookupPlayerAccountID( characterName as String ) as ID

Given a character name, if will find the account number if the names exists. If no account number, then the name is not yet used. Now we can find if the name belongs to a player or not.
Logged
Heroes and Villains Lead programmer/scripter
Exile Online Lead programmer/scriptor

Prometheus2012

  • General Accounts
  • *
  • Posts: 627
    • View Profile
    • Exile-Online
Re: {rsolved} Online DB only?
« Reply #5 on: Oct 16, 17, 02:30:55 PM »

Yah this worked nicely. Great Find Thaz!