Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-08-2005, 11:29 PM
Silent Silent is offline
<3
Silent's Avatar
Join Date: Mar 2005
Location: England
Posts: 132
Silent is on a distinguished road
Send a message via AIM to Silent Send a message via MSN to Silent
Multidimensional array problem

I have a class named silent_example which is joined to the player at logon, which is as follows:


PHP Code:
function onCreated() {
  echo(
"silent_example: Joined to " player.account);
  
player.clientr.example = new[2][2];
}

public function 
example_run() {
  echo(
"silent_example: Setting array value");
  
player.clientr.example[1][1] = 5;

Basically, the "player.clientr.example[1][1] = 5;" isn't doing anything. I've also tried player.clientr.example.replace(1,{0,5}) and player.clientr.example[1].replace(1,5) - nothing seems to work.

The array is being created fine, I can add to the array fine, both echos are working - I just can't edit the values from inside that public function. Any ideas?


Edit: Uh. Okay. That line doesn't work inside the onCreated either. What the hell?
__________________
Quote:
Originally Posted by MilkyWay0016
The Bible also says things like...

"Stone disobedient children" (Deuteronomy 21:18-21)
Quote:
Originally Posted by Loriel
Disobedient children are likely enough to get stoned already, I think.

Last edited by Silent; 09-08-2005 at 11:45 PM..
Reply With Quote
  #2  
Old 09-09-2005, 12:40 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
You can't have a clientr string starting from the player object I guess. o-o Remove the player object and it should work.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #3  
Old 09-09-2005, 12:54 AM
Silent Silent is offline
<3
Silent's Avatar
Join Date: Mar 2005
Location: England
Posts: 132
Silent is on a distinguished road
Send a message via AIM to Silent Send a message via MSN to Silent
Quote:
Originally Posted by ForgottenLegacy
You can't have a clientr string starting from the player object I guess. o-o Remove the player object and it should work.
Tried that, makes no difference
__________________
Quote:
Originally Posted by MilkyWay0016
The Bible also says things like...

"Stone disobedient children" (Deuteronomy 21:18-21)
Quote:
Originally Posted by Loriel
Disobedient children are likely enough to get stoned already, I think.
Reply With Quote
  #4  
Old 09-09-2005, 05:53 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Hmm, okay then. Are you doing this inside of a NPCw? Because, for what I know, NPCws cannot read onCreated() serverside.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #5  
Old 09-09-2005, 09:44 AM
Silent Silent is offline
<3
Silent's Avatar
Join Date: Mar 2005
Location: England
Posts: 132
Silent is on a distinguished road
Send a message via AIM to Silent Send a message via MSN to Silent
Quote:
Originally Posted by ForgottenLegacy
Hmm, okay then. Are you doing this inside of a NPCw? Because, for what I know, NPCws cannot read onCreated() serverside.
Re-read the first post, please . It's a class joined to the player, and the function is called very simply from a weapon:
PHP Code:
function onActionserverside() {
  if (
params[0] == "test"player.example_run();
}

//#CLIENTSIDE

if (weaponfired) {
  
triggeraction x,y,serverside,Silent/Example,test;

__________________
Quote:
Originally Posted by MilkyWay0016
The Bible also says things like...

"Stone disobedient children" (Deuteronomy 21:18-21)
Quote:
Originally Posted by Loriel
Disobedient children are likely enough to get stoned already, I think.
Reply With Quote
  #6  
Old 09-09-2005, 03:11 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Have you tried to do this.clientr.example[1][1] = 5; ? The "player" variable might not exist.
Reply With Quote
  #7  
Old 09-09-2005, 11:45 PM
Silent Silent is offline
<3
Silent's Avatar
Join Date: Mar 2005
Location: England
Posts: 132
Silent is on a distinguished road
Send a message via AIM to Silent Send a message via MSN to Silent
Quote:
Originally Posted by Stefan
Have you tried to do this.clientr.example[1][1] = 5; ? The "player" variable might not exist.
That doesn't work either
You can look at the scripts for yourself on ProjectR, if you like
__________________
Quote:
Originally Posted by MilkyWay0016
The Bible also says things like...

"Stone disobedient children" (Deuteronomy 21:18-21)
Quote:
Originally Posted by Loriel
Disobedient children are likely enough to get stoned already, I think.
Reply With Quote
  #8  
Old 09-10-2005, 03:22 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Does anything else from the class work? It might be that the player itself isn't joining the class or something. I honestly don't know.

Note: I don't know if onCreated() would be called when a player joins a class. o-o How about... join the class and call a public function afterwards?
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #9  
Old 09-10-2005, 12:56 PM
Silent Silent is offline
<3
Silent's Avatar
Join Date: Mar 2005
Location: England
Posts: 132
Silent is on a distinguished road
Send a message via AIM to Silent Send a message via MSN to Silent
Quote:
Originally Posted by ForgottenLegacy
Does anything else from the class work? It might be that the player itself isn't joining the class or something. I honestly don't know.
Once again, TGC, read the first post. "both echos are working"
__________________
Quote:
Originally Posted by MilkyWay0016
The Bible also says things like...

"Stone disobedient children" (Deuteronomy 21:18-21)
Quote:
Originally Posted by Loriel
Disobedient children are likely enough to get stoned already, I think.
Reply With Quote
  #10  
Old 09-10-2005, 05:13 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Hmm, we had a similar problem like this. Try putting the echo() AFTER initializing the array etc.
__________________
Liek omigosh.

Reply With Quote
  #11  
Old 09-10-2005, 10:06 PM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
yay for quirks! o.o
and yay for my vip running out unexpectedly -.- (see missing sig)
__________________
Reply With Quote
  #12  
Old 09-11-2005, 01:04 AM
Silent Silent is offline
<3
Silent's Avatar
Join Date: Mar 2005
Location: England
Posts: 132
Silent is on a distinguished road
Send a message via AIM to Silent Send a message via MSN to Silent
Quote:
Originally Posted by Ajira
Hmm, we had a similar problem like this. Try putting the echo() AFTER initializing the array etc.
It's still only initializing the array and not changing the value. I tried removing the echo completely too, no luck (also retried this.clientr. etc)
__________________
Quote:
Originally Posted by MilkyWay0016
The Bible also says things like...

"Stone disobedient children" (Deuteronomy 21:18-21)
Quote:
Originally Posted by Loriel
Disobedient children are likely enough to get stoned already, I think.
Reply With Quote
  #13  
Old 09-13-2005, 12:36 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
If you are joining a class to a player, would you use a different object (thiso. maybe, not sure) to get focus on the player?

Quote:
Originally Posted by calani
yay for quirks! o.o
and yay for my vip running out unexpectedly -.- (see missing sig)
Relevance, please.
__________________
Skyld
Reply With Quote
  #14  
Old 09-21-2005, 12:25 AM
Silent Silent is offline
<3
Silent's Avatar
Join Date: Mar 2005
Location: England
Posts: 132
Silent is on a distinguished road
Send a message via AIM to Silent Send a message via MSN to Silent
Quote:
Originally Posted by Skyld
If you are joining a class to a player, would you use a different object (thiso. maybe, not sure) to get focus on the player?
Tried, failed. Heck, I've tried every object combination I could think of, and the value still won't change. I was hoping someone would've figured this out while I was without internet access, but I guess not

Sure, there are other ways to do it, but this would be the most efficient and I see no reason why this way doesn't work. Bleh.
__________________
Quote:
Originally Posted by MilkyWay0016
The Bible also says things like...

"Stone disobedient children" (Deuteronomy 21:18-21)
Quote:
Originally Posted by Loriel
Disobedient children are likely enough to get stoned already, I think.
Reply With Quote
  #15  
Old 09-22-2005, 01:48 PM
Ibonic Ibonic is offline
unsoundness
Ibonic's Avatar
Join Date: Sep 2002
Location: Long Island <3
Posts: 783
Ibonic will become famous soon enough
It does appear to be doing something: assigning the value, at least temporarily.


NPC Code:

player.clientr.example = new[2][2];
player.clientr.example[1][1] = 5;

echo(player.clientr.example[1][1]);



But when viewing the player attributes it shows as: clientr.example="0,0","0,0" -- that part is unexpected. It also loses the value when the player disconnects (or maybe even sooner), which is almost definitely related to it not setting the attribute variable correctly. As stated already, it doesn't make a difference whether you do or don't use the "player variable", or even the clientr/client ones for that matter.



As an extra note, it works fine if you use something like this in a NPC (for example)

NPC Code:

function onCreated() {
this.example = new[2][2];
this.example[1][1] = 5;

}



That shows: example="0,0","0,5" in the flags, as expected.

---

Maybe that will help (Stefan?) debug a bit, if nothing else.

Last edited by Ibonic; 09-22-2005 at 02:47 PM..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:37 PM.


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