Hi, for Everworld I’m going to develop a system such that people can purchase mailboxes for messages to be left for them to retrieve.
The way I’m going about this is to have it so that their mailbox is a physical box and other players can purchase empty letters (using putnpc), give them a message (touching the letter while saying /write “Message”), then toss them into physical mailbox. This way, players can access their mailboxes and collect their messages. I remember seeing this on Damasca some years ago, to be honest.
Does anybody here have a suggestion for a way that they think would work better that can be scripted with the current client? I can script the above, but something about the system seems rudimentary to me so I’m asking if anybody else has a suggestion.
My Graal seems to crash if I leave it without using it for a period greater than thirty minutes, so I’m not sure how well attaching information to a player (and using it as an NPC server of sorts) would work.
mm not really that crazy. Pretty much, each player will have access to change maybe 1 or 2 stringlists at their specified index. Then the server has one main message composition string(or more later if it gets congested). When a player wants to send a mail message, they will switch their index of the 1st server string to 1. Which signals the bot player that someone is sending a message. The player’s message contents will replace the server composition string. The bot player then copies that message into a local string, copies the senders playerid into an array, and the sendto playerid into a matching array. Then the bot player switches the index at the sender’s id back to 0. Then sets a string to make the next player in queue change the server composition string to their message contents.
When a player goes to retrieve their mail, they will just switch their 2nd server string index to 1. The bot player will then scan the sendto array for the player’sid to tell what message go to them. Then using a bot only server string similar to the composition string, the bot player will paste the stored messages into the string. Then using another bool activated string, get the player to turn that string to into a local one. Once the player has copied all his mail clientside, the bot player will delete the bot’s local copy of the message and clear the array positions.
You would also have to have 1 more bool server string to tell the online status of the mail system bot. The bot would constantly update that string to 1 when he was online. The mailbox send/receive places could ping this string by changing it to 0, then seeing if it get’s turned back to 1.
All in all, 2 server stringlists, 2 server composition strings, 1 server string for bot online status. The bot will have a string copy for every message, aswell as two arrays with stored sender/reciever info. Array’s with under 6000 entries run fast tho.
For the love of…
Just use serverstrings. It will be a lot simpler; Granted how much people random lag, you won’t notice any difference until its far too late.
server.receiveracc_00=senderacc,“I am Message”
Find a Target. Scan for their pending messages, 0~20?
Find a blank spot, set a string.
setstring server.#s(target)_#v(openvariable),#a,“I am your message”;
Person checks their mail…
Looking for any server.string thats not blank. #s(server.#a_#v(scanvar))
It should be fine, in that its not a very active system.
Chances are that you’ll have more than one person sending someone a message at nearly the same time is non-existant. So you’ll very rarely suffer cases of people overwriting server.strings
I’m sure you could avoid overwriting messages by using ID’s, couldn’t you? Then, as messages are deleted, you could recycle the ID’s so that you’re not dealing with message ID number 23904823948023948309248209. You could make the script just look through the strings for an unused ID and only make a new one if it can’t find an open spot.
If one player doesn’t find an ID when they set something, they will set it to that ID; Regardless if the server was sent a request to fill the ID a moment prior.
Spitting out random numbers just would involve more scanning and still runs the risk of overlapping.
uhm… couldn’t it change the strings for the account name then just send the other part of the string (the message) to the player via say2 or some shit? Could even make it add in a #b after every 10 characters or so.
I’ve stopped understanding the script-speak a few posts ago :-/
As for what’s currently up, a mailbox is an actual box that takes up some tiles. The entrance to the box says the account name of the mailbox owner with a message command. Only the person with that account name can pass. As for the letters, players can toss them inside the box. The letters are npcs that are placed using putnpc and players are able to use the chat commands “/read”, “/write” and “/destroy” for different functions. The problem I’m currently having is that the letters, being throwable, dissapear for all players except the “thrower”.
Is there some way around this without using server strings et al?
If I might make a suggestion to this mail system. Please disable the toall command so this can be used to it’s fullest ability. Otherwise it’s not going to be neat to use for no more than mere minutes.
Reminds me when Era have there phone system back in the day, you dialed a number and some other graalian from that location would pick up and the text appeared on both ends when talking. They forgot to disable toalls though and was pretty much useless.
This is quite different from a toall. This is more like in-game email. Even more so, a persistent PM system. Instead of a player losing a PM when they log off, in-game mail will stay until the player reads and/or deletes it. Toalls are a totally different type of message. It’s like comparing “whispering in someone’s ear” to “yelling out to a crowd.” Totally different categories, here.
What’s the point of that? PMs already get logged by the client. That’s why I’m saying disable the default features so this is useful on an online server.