PDA

View Full Version : player.variables and saving to database npcs


Prozac
04-10-2006, 05:30 AM
I checked the wiki but could only get player.colors[array].
Where can I get a list of every player.attribute
such as
player.hearts
player.rupees
player.swordpower
player.chat

for absolutely everything that belongs to the player?

Also, http://wiki.graal.net/index.php/Creation/Dev/Database_NPC
does not tell me how to create, access or modify a variable in a database npc.

Let's say I have a database npc called foo.
i want to give foo a variable called bar with a value of "foobar".
then I want to set the player.chat to the value of foo's variable bar.

then i want to change foo's variable bar to be the player's chat string.

never seen an example of how to do that with a database npc, can't find one... please provide npc-speak to that algorithm. thanks in advance

napo_p2p
04-10-2006, 05:35 AM
I checked the wiki but could only get player.colors[array].
Where can I get a list of every player.attribute
such as
player.hearts
player.rupees
player.swordpower
player.chat

for absolutely everything that belongs to the player?http://wiki.graal.net/index.php/Creation/Dev/Script/Client/TServerPlayer
http://wiki.graal.net/index.php/Creation/Dev/Script_Functions:_NPC_Server
-Find TServerPlayer


Let's say I have a database npc called foo.
i want to give foo a variable called bar with a value of "foobar".
then I want to set the player.chat to the value of foo's variable bar.

then i want to change foo's variable bar to be the player's chat string.

never seen an example of how to do that with a database npc, can't find one... please provide npc-speak to that algorithm. thanks in advancetemp.db = findnpc("foo");
temp.db.bar = "foobar";
player.chat = temp.db.bar;

Prozac
04-10-2006, 06:09 AM
hmm .. no access to the player's comments through a player variable i see.
but thanks for the links!

and thanks also for the db code .. simpler than i thought.
just that the db has to be accessed serverside, and the player.chat set clientside.

napo_p2p
04-10-2006, 06:14 AM
just that the db has to be accessed serverside, and the player.chat set clientside.

Yes, you have to access the db code serverside. But, you can set the player's chat serverside too.

napo_p2p
04-10-2006, 06:23 AM
hmm .. no access to the player's comments through a player


Also, a very simple example of getting comments:

//#CLIENTSIDE
function onPlayerChats() {
if (player.chat.starts("/comments")) {
requesttext("comments", player.chat.substring(10).trim());
}
}

function onReceiveText(texttype, textoptions, textlines) {
if (temp.texttype == "comments") {
echo("Comments for: " @ temp.textoptions);
for (temp.line: temp.textlines) {
echo(temp.line);
}
}
}

Comments will appear on the console/log (F2).
Command: /comments account

Note: This only works if you have rights to view comments.