Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-10-2006, 04:30 AM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
player.variables and saving to database npcs

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/Crea...v/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
Reply With Quote
  #2  
Old 04-10-2006, 04:35 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Prozac
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/Crea.../TServerPlayer
http://wiki.graal.net/index.php/Crea...ns:_NPC_Server
-Find TServerPlayer


Quote:
Originally Posted by Prozac
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
PHP Code:
temp.db findnpc("foo");
temp.db.bar "foobar";
player.chat temp.db.bar
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 04-10-2006, 05:09 AM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
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.
Reply With Quote
  #4  
Old 04-10-2006, 05:14 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Prozac
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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #5  
Old 04-10-2006, 05:23 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Prozac
hmm .. no access to the player's comments through a player

Also, a very simple example of getting comments:

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

function 
onReceiveText(texttypetextoptionstextlines) {
  if (
temp.texttype == "comments") {
    echo(
"Comments for: " temp.textoptions);
    for (
temp.linetemp.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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:28 PM.


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