PDA

View Full Version : triggerserver/gui lag?


Andy0687
11-10-2006, 09:34 AM
Im having a bit of a problem with one of my npcs triggering the server, when i am using triggerserver() i echo the params to my RC and they are exactily what they should be, but the params are Effecting the last player that I used the npc on.

Example: I will use the npc to edit "Andy0687" by selecting from a GUITextList then i will select someone else through the textlist to edit them, but it will still edit me until i press the button twice, on the second time, it effects the correct person.

As ive said I already tried Echoing all the params and they all turn out right, anyone else experinced this?

If it matters im doing the triggerserver through a button on a GUI.

Thanks

Chompy
11-10-2006, 06:14 PM
posting the part of the script which is doing this could help?

Also do you have like

with(findplayer(params[index]))
{
...
}

when you have recieved the trigger?

if don't, it will effect the player itself

Andy0687
11-11-2006, 06:33 AM
posting the part of the script which is doing this could help?

Thats the problem!

I dont know what part is doing this, its always effecting the LAST EFFECTED PLAYER once before effecting the correct account, even though after I echo the params they are all showing that the newly selected player should be the one effected. The way im trying to explain it is even though it sends a new set of params, the last set of params are always executed a second time before the new set is recognized.

This ONLY started when i started using a GUI and triggerserver() instead of triggeraction() to trigger to the serverside.


Also do you have like

with(findplayer(params[index]))
{
...
}

when you have recieved the trigger?

if don't, it will effect the player itself

Yes I know i was giving an example using myself and someone else, it would work the same if I had edited someone else first, and me second >_<

Its just an example!

Chompy
11-11-2006, 01:44 PM
post the recieving at serverside?

function onActionServerside()
{
switch(params[0])
{
case "test":
with(findplayer(params[1]))
echo("My account is " @ player.account SPC "and I am bored.");
break;
}
}
//#CLIENTSIDE
function onPlayerChats()
{
if (player.chat == "/test")
{
t = player.chat.tokenize();
triggerserver("gui", this.name, "test", t[1]);
}
}
// Just an example, I don't even know if it works, written directly

Is it something like this?

btw, you can post some parts of the script that you think is wrong with the script tho

Andy0687
11-11-2006, 10:08 PM
function onActionserverside() {
g = findplayer(params[1]);
if (params[0] == "warpto") {
setlevel2(g.level, g.x, g.y);
}
}
//#CLIENTSIDE
...[gui codes blah]...
function SomeWarpButton_onAction() {
triggerserver("gui", this.name, "warpto", this.paccount);
}


FOR EXAMPLE! I rewrote this off my top of my head because im not at home right now but would still like some help.

If i switch to Player1 for example, and warp to them, and walk away, and choose to warpto player2, when i press the button again for player2 it will warp to Player1, when i press it a second time, it warps to player2, even though when i warped the FIRST time, the params said this.paccount was set to Player2.

Chompy
11-11-2006, 10:14 PM
g = findplayer(params[1]);
if (params[0] == "warpto") {
setlevel2(g.level, g.x, g.y);

would make the current player warp too the other players position >_>

try
if (params[0] == "warpto") {
with(findplayer(params[1])) {
setlevel2(params[2], params[3], params[4]);


ALSO you can add the coordinats in the triggerserver();

Andy0687
11-11-2006, 10:17 PM
g = findplayer(params[1]);
if (params[0] == "warpto") {
setlevel2(g.level, g.x, g.y);

would make the current player warp too the other players position >_>

Thats the point!

But my problem is that it isnt recieving the triggers accurately! Its not changing to the proper findplayer to warp me to the right location even though the params say it is, until i click the button TWICE!

Did you read what i said last post? >_<

Chompy
11-12-2006, 01:05 AM
also, function SomeWarpButton_onAction() {

its
function SomeWarpButton.onAction() {
and have you tried like .onSelect()? dunno if that would work anyway,
but try to catch the event to it, or post whole script and take out some parts?

Andy0687
11-12-2006, 05:39 AM
also, function SomeWarpButton_onAction() {

its
function SomeWarpButton.onAction() {


Speedy typo on my part i have .onAction() for the buttons.


and have you tried like .onSelect()?

Thats for Textlists and stuff only i think, the buttons WORK fine in theory, but lag when sending triggers.


but try to catch the event to it, or post whole script and take out some parts?

Ive pretty much posted the entire script in its smallest form, the rest are just offshoots of a basic function. The warpto is the most basic function I have that is still causing problems triggering. Every function below that also has the params lag.

Chompy
11-12-2006, 03:11 PM
I've been testing, and when using triggerserver() or triggerclient()
I've found out that, the param where you put the name of the weapon,
if you put this.nick, it'll use more time sending and recieving the trigger,
but if you write in the name directly instead of using this.nick,
it will send and recieve faster.. dunno why tho.

Btw, you could test with a name written directly into the triggerserver()
you're using instead of "this.nick".

Andy0687
11-13-2006, 02:56 AM
Btw, you could test with a name written directly into the triggerserver()
you're using instead of "this.nick".

Nope that still didnt help, Still have to push the button Twice in order for the action to go through.

I am wondering why no one else has chimed in on this issue yet? Ive tried everything to get it to stop!

Andy0687
11-26-2006, 01:46 AM
Bumped because i think ive isolated the problem?

It seems to be only when i select the players account out of a GuiTextListCtrl when i refresh the control to select the account again, i get the delay before it becomes active on the player, Likewise i get the delay when i am selecting a new player out of the TextList.

I dunno if this is relevant in any way.

Chompy
11-26-2006, 02:00 AM
try use a sleep(.05); before doing it, if you have a timeout in the script, call the timeout after the sleep

Andy0687
12-22-2006, 01:04 AM
try use a sleep(.05); before doing it, if you have a timeout in the script, call the timeout after the sleep

I figured out what the real problem is now, after I tested it in a new npc


function onActionServerside() {
switch(params[0]) {
case "p":
this.join("example1");
break;
case "l":
this.join("example2");
break;
}
}


The code inside the joins are not executed after they are joined, but on the second time I use it, after it has joined the first time, is this intended? And if so, can someone give me some hints towards getting around this? (Was breaking the npc up into "states" for example, to join different things at different times.

Edit: I realise its been almost a month since i posted this but I decided to go back and try to find out the problem because it was aggrivating me