PDA

View Full Version : Attr serverside


Chandler
04-26-2007, 11:55 AM
Well, it doesn't seem to display it correctly... It's showing it clientside, however it refuses to display it serverside.

Here's how I activate it, it removes the attr then re-assigns it. Which works fine


core.onremoveAttr(temp.par1[0]);
core.assignAttr({temp.par1[0], temp.par1[1]}, true);


Here's how I trigger the code


triggerclient("weapon", "-systemMain", "editAttr", {{4}, {"c_player-displaytext.gani, " @ temp.messageText}});


Here's the gani script:


SCRIPT
//#CLIENTSIDE
function onPlayerEnters()
{
temp.messageText = player.attr[4].tokenize()[1];
this.imageIndex++;

if (this.imageIndex > 5)
this.onHideImage(0);

with(findimg(this.imageIndex))
{
attachtoowner = true;
layer = 3;
x = (player.x + 1);
y = (player.y - 1);

with (emitter)
{
continueafterdestroy = true;
emitautomatically = false;

nrofparticles = 1;

with (particle)
{
lifetime = 0.9;
text = temp.messageText;
mode = 0;

red = (temp.messageText.starts("-")? 1: 0);
blue = 0;
green = (temp.messageText.starts("+")? 1: 0);

style = "bi";
alpha = 1;
zoom = 1;

angle = (pi / 1);
speed = 4;
}

addlocalmodifier("range", 0.375, 0.875, "alpha", "replace", 1, 0);
addlocalmodifier("range", 0.1, 0.75, "speed", "replace", 4, 1);

this.emit();
}
}
scheduleevent(0.9, "HideImage", this.imageIndex);
}

function onHideImage(messageIndex)
{
hideimg(temp.messageIndex);
this.imageIndex--;
}
SCRIPTEND


Anyone have any ideas? thanks

Kristi
04-26-2007, 05:52 PM
You only init the particle engine once, so its stuck with the text you init it at.
You need to change the emitters text in some event.

Chandler
04-26-2007, 06:18 PM
You only init the particle engine once, so its stuck with the text you init it at.
You need to change the emitters text in some event.

No, it's displaying all that fine.
It isn't displaying any text serverside...

Inverness
04-26-2007, 06:49 PM
People seem to try to fix things with other people's scripts that aren't broken all too often.

Anyhow, whats this serverside part you speak of? I don't get quite what you're talking about.

Chandler
04-26-2007, 07:05 PM
People seem to try to fix things with other people's scripts that aren't broken all too often.

Anyhow, whats this serverside part you speak of? I don't get quite what you're talking about.

When playerA hits a playerB, playerB can only see the effect. Shouldn't playerA also see it?

Rapidwolve
04-26-2007, 10:05 PM
You have the script in the gani clientsided, remove that and it should work fine

Skyld
04-26-2007, 10:12 PM
You have the script in the gani clientsided, remove that and it should work fine
I.. don't think that's the solution. You should always have GANI scripting working clientside.

Kristi
04-26-2007, 10:14 PM
You have the script in the gani clientsided, remove that and it should work fine

all gani scripts are clientsided -.- to the gani thats just a comment.

No chandler, on player enters only occurs to another player at the moment they first see you since login, after that the onPlayerEnters will not trigger again for that person. therefore, whatever you initilized the text in the emitter to will stay that way in their eyes.

Inverness, stop with the unneccessary attacking. It gets old.

if you are removing the ani then resetting it (with either set ani or an attribute) within the same cycle, that wont get sent out ot the other players, just locally. the other players get updated with new information at the end of the cycle. if you set a players attr to 3 then "hi" then 2 then "ho" whatever, and then the cycle ends, they will only update it with "ho"

Rapidwolve
04-26-2007, 10:15 PM
Well I was just saying because I work with GANI scripts all the time and everything Chandler is doing looks fine to me. The only thing I noticed that his had that mine didnt was the clientside.

Chompy
04-26-2007, 10:34 PM
Well I was just saying because I work with GANI scripts all the time and everything Chandler is doing looks fine to me. The only thing I noticed that his had that mine didnt was the clientside.

Because gani scripts are clientside-only, so it doesn't matter if you have that little line or not :p

Can't go serverside in ganises :[

Inverness
04-26-2007, 10:42 PM
Its odd the onPlayerEnters() is triggered only once in the gani, is there a reason for it?
Can't say much though since I rarely mess with Gani scripts.
Inverness, stop with the unneccessary attacking. It gets old.I'm in school, had to do something to alleviate my boredom. Though I still didn't get my problem fixed :frown:. It doesn't really matter so much now that I'm no longer working on that project due to limitations in the engine but I would still like to get that engine bug checked out, and I know its an engine bug.

xXziroXx
04-27-2007, 12:25 AM
I'm in school, had to do something to alleviate my boredom.

Not really an excuse.. :rolleyes:

Inverness
04-27-2007, 01:07 AM
Not really an excuse.. :rolleyes:I don't care. People who try to correct things without understanding them irritate me. Same with people who dodge questions.

Admins
04-27-2007, 01:07 AM
When you change the attr[] on serverside then it should correctly invoke the onPlayerEnters() event on the clientside (also make sure the gani is not CONTINUOUS)
When it doesnt display the text eventually also try to echo() the text in onPlayerEnters()

Chandler
04-27-2007, 09:15 AM
When you change the attr[] on serverside then it should correctly invoke the onPlayerEnters() event on the clientside (also make sure the gani is not CONTINUOUS)
When it doesnt display the text eventually also try to echo() the text in onPlayerEnters()

It's changing it clientside, maybe that's the problem?


Kristi: Thanks, however I did ''remove'' the attr from the player when I wanted a new message to show.

Thanks everyone for the replys

Kristi
04-27-2007, 05:42 PM
It's changing it clientside, maybe that's the problem?


Kristi: Thanks, however I did ''remove'' the attr from the player when I wanted a new message to show.

Thanks everyone for the replys
yeah, you cant just remove and reset, because that means you removed it and set it again, but to everyone else when you updated it, the ani stayed the same since it only sends out the last value.

Chandler
04-27-2007, 08:27 PM
yeah, you cant just remove and reset, because that means you removed it and set it again, but to everyone else when you updated it, the ani stayed the same since it only sends out the last value.

(Should I make it serverside? lol)

zokemon
04-28-2007, 12:16 AM
No chandler, on player enters only occurs to another player at the moment they first see you since login, after that the onPlayerEnters will not trigger again for that person. therefore, whatever you initilized the text in the emitter to will stay that way in their eyes.

Really? In my gani scripts, onPlayerEnters() always seems to be called more then once... That is why I have a problem with emitters usually since the addlocalmodifier functions and such are often recalled (when placed in the onPlayerEnters).

Skyld
04-28-2007, 12:52 AM
Really? In my gani scripts, onPlayerEnters() always seems to be called more then once... That is why I have a problem with emitters usually since the addlocalmodifier functions and such are often recalled (when placed in the onPlayerEnters).
In GANI scripts, onPlayerEnters() is tied to the attr[]s I think.

Chandler
04-29-2007, 12:59 AM
Making it serverside didn't do ANYTHING.

Kristi
04-29-2007, 06:05 AM
Making it serverside didn't do ANYTHING.

that wouldnt work, youd either have to remove the gani as attr, wait some time, and then set it, isntead of setting it in the same cycle.

the way i suggest around it is that have a timeout in the gani script check if the text attr has changed, and if it has, update it with findimg in the timeout.

Chandler
04-29-2007, 09:41 AM
that wouldnt work, youd either have to remove the gani as attr, wait some time, and then set it, isntead of setting it in the same cycle.

the way i suggest around it is that have a timeout in the gani script check if the text attr has changed, and if it has, update it with findimg in the timeout.

Ahhh, a timeout! :(
Sucks, thanks :p