Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Client to Server string (https://forums.graalonline.com/forums/showthread.php?t=54992)

ZeroTrack 08-20-2004 09:37 PM

Client to Server string
 
see my problem is in clientside the string this.trade shows all the items selected , the thing is when its transfered to serverside the string automaticly trims itself ? :\ and only the first string in the set is seen.... now there are ways around this which i've already done . but why does this happen??
~Sern
NPC Code:

if(actionserverside){
if(strequals(#p(0),trade)){
tokenize #p(3);

//Start put in for testing
with(getplayer(#p(2))){
setplayerprop #c,#p(3);}
//End put in for testing

for(n = 0; n < tokenscount; n ++){
if(strtofloat(#s(clientr.amount_#t(n))) > 1){
this.remove = strtofloat(#s(clientr.amount_#t(n))) - strtofloat(1);
setstring clientr.amount_#t(n),#v(this.remove);
}else {
removeweapon #t(n);
setstring clientr.amount_#t(n),0;
}
}
with(getplayer(#p(2))){
for(a = 0; a < tokenscount; a ++){
if(hasweapon(#t(a))){
this.add = strtofloat(#s(clientr.amount_#t(a))) + strtofloat(1);
setstring clientr.amount_#t(a),#v(this.add);
}else{
addweapon #t(a);
setstring clientr.amount_#t(a),1;
}
}
sleep .5;
}
}
}

//#CLIENTSIDE
triggeraction 0,0,serverside,Items/Weapon Trader,trade,#a,#a(k),#s(this.trade),;


Python523 08-20-2004 09:47 PM

//#SERVERSIDE doesn't exist.

Eagle 08-20-2004 09:53 PM

I'm not the best at scriting, but try putting your serverside scripting before the "//#CLIENTSIDE", considering "//#SERVERSIDE" doesn't exsist, as I use it for organization.

ZeroTrack 08-20-2004 10:58 PM

i put those there so you'd know which script is where .... lol please have alittle common sense guys

~Sern

Goboom 08-20-2004 11:02 PM

Quote:

Originally Posted by ZeroTrack
i put those there so you'd know which script is where .... lol please have alittle common sense guys

~Sern

Have a little common sence, this is a scripting forum the people that will help you will know which script is where without the "//#SERVERSIDE". ;)

ZeroTrack 08-20-2004 11:05 PM

wow your all way too litteral, and stupid for that matter. Is there a problem should i edit my post , is it that big of a deal where your gonna cry about it or explain to me why that happens. i've been scripting on graal for over 5 years im not stupid and im deff no new at this. if your really gonna keep going on about it i'll edit it so you can stop whinning about it.



HAPPY..?? gosh

Tolnaftate2004 08-20-2004 11:25 PM

If this.string uses commas to separate indecies, you probably want to put #s(this.trade) in quotes.

ZeroTrack 08-20-2004 11:47 PM

every string uses commas to separate indecies, i added setplayerprop #c,#s(this.trade) in the clientside before the triggeraction to see if the full string would show. and it did the problem happens when it sends the string to serverside it seems to automaticly trims it and only use the first string in the list or it can only see the first string in the list for some reason... so for example:
if, this.trade = gun,sword,bombs
in clientside it'll see all 3 but in serverside it only sees gun

WanDaMan 08-20-2004 11:50 PM

setplayprop is serverside?

ZeroTrack 08-21-2004 12:12 AM

yes its is

Lance 08-21-2004 12:47 AM

Quote:

Originally Posted by ZeroTrack
wow your all way too litteral, and stupid for that matter. Is there a problem should i edit my post , is it that big of a deal where your gonna cry about it or explain to me why that happens. i've been scripting on graal for over 5 years im not stupid and im deff no new at this. if your really gonna keep going on about it i'll edit it so you can stop whinning about it.



HAPPY..?? gosh

Please do not come in this forum calling people stupid for pointing out your error. How long you claim to have scripted for Graal is wholly irrelevant.

To address your original problem: place quotation marks in your triggeraction around the comma-containing string.

Quote:

Originally Posted by WanDaMan
setplayprop is serverside?

It can be used clientside and serverside.

ZeroTrack 08-21-2004 05:33 AM

i know i already fixed what was going on, i just wanted to know why it was doing that... the logic behind it hence

Quote:

Originally Posted by ZeroTrack
now there are ways around this which i've already done . but why does this happen??
~Sern

Basicly my original question was.... why does this happen?

XiLe 08-21-2004 04:41 PM

Serer strings trim themselves for no apparent reason. Probably the fact that the character initiated in the gserver has a limited length, so it truncates anything beyond that. Try using DB-NPCs, their strings seem much longer.

For example, replace this:
NPC Code:
setstring serverr.asdf,1234567890;



with this:
NPC Code:
with (getnpc(moo)) {
setstring this.asdf,1234567890;
}



Don't forget to read up on this. and thiso. strings/variables, as they play a role in DB-NPC interation.

Crono 08-21-2004 04:51 PM

Wow, Sern is back. He used to be my personal god of scripters until i left my **** stage.

ZeroTrack 08-21-2004 11:02 PM

Quote:

Originally Posted by Gerami
Wow, Sern is back. He used to be my personal god of scripters until i left my **** stage.

lOl why thank you very much, i've kinda kept low cause i didnt want people to think i was tring to be something just for power or w.e so i decided not even to try for GST anymore , i dont care if i get it or not i just love helping people and scripting
------------------------------------------------------------------------
Hmm very weird why it does that.... then again tis true that graal script goes against all other scripting languages in the world lol


All times are GMT +2. The time now is 02:20 PM.

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