Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-20-2004, 09:37 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Question 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),;


Last edited by ZeroTrack; 08-20-2004 at 11:16 PM..
Reply With Quote
  #2  
Old 08-20-2004, 09:47 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
//#SERVERSIDE doesn't exist.
Reply With Quote
  #3  
Old 08-20-2004, 09:53 PM
Eagle Eagle is offline
Registered User
Eagle's Avatar
Join Date: Jul 2004
Location: Boston, MA
Posts: 584
Eagle will become famous soon enough
Send a message via AIM to Eagle
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.
__________________

AIM : FCartman007
Old account - 190
Reply With Quote
  #4  
Old 08-20-2004, 10:58 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
i put those there so you'd know which script is where .... lol please have alittle common sense guys

~Sern
Reply With Quote
  #5  
Old 08-20-2004, 11:02 PM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
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".
__________________
Reply With Quote
  #6  
Old 08-20-2004, 11:05 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to 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

Last edited by ZeroTrack; 08-20-2004 at 11:17 PM..
Reply With Quote
  #7  
Old 08-20-2004, 11:25 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
If this.string uses commas to separate indecies, you probably want to put #s(this.trade) in quotes.
Reply With Quote
  #8  
Old 08-20-2004, 11:47 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
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
Reply With Quote
  #9  
Old 08-20-2004, 11:50 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
setplayprop is serverside?
__________________
V$:CONFL16T
Reply With Quote
  #10  
Old 08-21-2004, 12:12 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
yes its is
Reply With Quote
  #11  
Old 08-21-2004, 12:47 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
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.
Reply With Quote
  #12  
Old 08-21-2004, 05:33 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
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?
Reply With Quote
  #13  
Old 08-21-2004, 04:41 PM
XiLe XiLe is offline
Lylic < Me
XiLe's Avatar
Join Date: Dec 2002
Location: My House
Posts: 224
XiLe is on a distinguished road
Send a message via AIM to XiLe Send a message via MSN to XiLe
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.
__________________
AIM: xilesaim MSN: [email protected]
I'm the Co-Owner of Atrius... If you've got questions, ask me
Reply With Quote
  #14  
Old 08-21-2004, 04:51 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Wow, Sern is back. He used to be my personal god of scripters until i left my **** stage.
__________________
Reply With Quote
  #15  
Old 08-21-2004, 11:02 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
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
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 09:47 AM.


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