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 02-16-2007, 11:43 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Awesome, another gani related question!

So like, Ive been having this problem for quite some time now.. its the same problems Stan recently posted about, but I didnt want to hijack his thread with my own question.

I checked that thread, didnt come up with a solution. Perhaps Im just tired? Hmm.. so anyways, the problem:


PHP Code:
  player.attr[20] = "ml_hud.gani";
  
player.attr[21] = { "test""xd"}; 
PHP Code:
SCRIPT
function onPlayerEnters() setTimer(.05);

function 
onTimeOut()
{
  if (
player.attr[21] != NULL) {
    
this.pos = { player.1.5player.2player.};
    
showtext(201this.pos[0], this.pos[1] - 2"Verdana""b""TEST [" player.attr[21][1] @ "]");
  }
  
setTimer(.05);
}
SCRIPTEND 
This is displaying the text "TEST [xd]" over MY player, but I just see "TEST []" over the other players in the level. Same thing goes for everyone else, they only see the text "TEST [xd]" over themself and no one else.

My question is, how do I fix this?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #2  
Old 02-16-2007, 03:03 PM
ToNy_W ToNy_W is offline
Registered User
Join Date: Aug 2003
Location: Quebec
Posts: 130
ToNy_W is on a distinguished road
Send a message via AIM to ToNy_W
Hmm, arrays in player attributes never worked for me, what i do is convert my array to a string before sending it to the attributes, and it works fine...

this.array {"test", "array"};
player.attr[10] = (@this.array);
this.array = player.attr[10];

I remember readign on the forums about the same problem a couple of months ago but don't remember how it ended, so there might be a better solution but this oen works for me :P
Reply With Quote
  #3  
Old 02-16-2007, 04:10 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
try
PHP Code:
player.attr[21] = "test, xd"
I've used that before..
__________________
Reply With Quote
  #4  
Old 02-16-2007, 04:30 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by ToNy_W View Post
Hmm, arrays in player attributes never worked for me, what i do is convert my array to a string before sending it to the attributes, and it works fine...

this.array {"test", "array"};
player.attr[10] = (@this.array);
this.array = player.attr[10];

I remember readign on the forums about the same problem a couple of months ago but don't remember how it ended, so there might be a better solution but this oen works for me :P
That would be me that posted it a few months ago, never got a working answer. And the array works, obviously, since it can be read. So I doubt thats the issue here.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 02-16-2007, 04:37 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Wait, this is the same problem I had with my floating text >_>

I just have something to change/show the text when a other attr is changed while the attr[ 21] is changed, like

PHP Code:
player.attr19] = !player.attr19];
player.attr20] = "ml_hud.gani";
player.attr21] = { "test""xd"}; 
then show the text when player.attr[ 19] is changed.. :O
Just a thought tho
__________________
Reply With Quote
  #6  
Old 02-16-2007, 04:46 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Chompy View Post
Wait, this is the same problem I had with my floating text >_>

I just have something to change/show the text when a other attr is changed while the attr[ 21] is changed, like

PHP Code:
player.attr19] = !player.attr19];
player.attr20] = "ml_hud.gani";
player.attr21] = { "test""xd"}; 
then show the text when player.attr[ 19] is changed.. :O
Just a thought tho
That just sounds ridiculous, and I sincerely hope that wont work. Sorry, but, I think I'll wait for someone to tell me WHY its not working.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 02-16-2007, 04:46 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by xXziroXx View Post
That just sounds ridiculous, and I sincerely hope that wont work. Sorry, but, I think I'll wait for someone to tell me WHY its not working.
Read the other thread I made, Kristi explained it pretty well..

http://forums.graalonline.com/forums...ad.php?t=72108 @ post 16
__________________
Reply With Quote
  #8  
Old 02-16-2007, 08:04 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
In the gani, don't make it display the actual player attribute. Do something like
HTML Code:
function onCreated()
{
  this.doEffect(params[0]);
}
function doEffect(curText)
{
  showtext(301, player.x, player.y, "Arial", "bc", temp.curText);
  changeimgvis(301, 3);
  changeimgzoom(301, 0.8);
  setTimer(5);
}
function onTimeout()
{
  hideimg(301);
}
Then just make a loop of player attributes and then assign those attributes to the gani. If you don't understand this, I'll go futher more into details.
Reply With Quote
  #9  
Old 02-16-2007, 08:16 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
The problem is that attr[] are basicly strings (even if they look like normal variables). So it is better to do something like:
temp.var = player.attr[21];
echo("test: " @ temp.var[1]);
Reply With Quote
  #10  
Old 02-16-2007, 08:18 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by xXziroXx View Post
That would be me that posted it a few months ago, never got a working answer. And the array works, obviously, since it can be read. So I doubt thats the issue here.
I have a hunch, but I am at work so I cannot confirm or deny this right now, but checkit.

The array obviously is not working, a truth which contridicts your statement. Why would you be posting?

I am not sure what part of your npc you are pulling your code from but bear with me. You are assigning that attribute clientsided, yes? Your clientside variable may very well be able to store that array, that attr variable on your clientside is nothing more then a variable. HOWEVER, when another player pulls it from you, they are only getting the first index, since attr cannot handle anything else between clients. If my memory serves me correctly, attributes have to be strings. If this be the case, the optimal solution you have available to you is converting it to a string before sending it, such as putting the @ in front as I had earlier seen in this thread.
__________________
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 05:22 PM.


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