Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-17-2002, 10:15 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
deletestring (serverside)

Quote:
commands.rtf
deletestring list,index; deletes string list entry at position 'index'
It is not working correctly. I said it should delete index 1, but it removed index 0.
Now I have to use this:
NPC Code:

// deletestring clientr.hats,hatnum;

setstring temp,;
for (i=0; i<sarraylen(clientr.hats); i++) {
if (i != hatnum) addstring temp,#I(clientr.hats,i);
}
setstring clientr.hats,#s(temp);
setstring temp,;



I don't know whether it is working clientside/offline.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #2  
Old 11-18-2002, 06:48 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm will become famous soon enough
...you're starting at the highest index and working down, right?
Otherwise you're gonna skip every other index...
Delete 0
Index 1 becomes Index 0, 2 becomes 1, etc.
Delete 1 (formerly index 2...)
Delete 2 (formerly index 4...)
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #3  
Old 11-20-2002, 02:34 AM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Quote:
Originally posted by Tyhm
...you're starting at the highest index and working down, right?
Otherwise you're gonna skip every other index...
Delete 0
Index 1 becomes Index 0, 2 becomes 1, etc.
Delete 1 (formerly index 2...)
Delete 2 (formerly index 4...)
Sorry, what are you talking about?
Do you mean that I used deletestring the wrong way? I didn't even use it in a loop.
Are you talking about the script I am using as replacement? I just copied every thing else into another string.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #4  
Old 12-02-2002, 02:49 AM
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
I am using deletestring for many things and its working, can you post some code example?
Reply With Quote
  #5  
Old 12-02-2002, 03:01 AM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
I don't want to publish it here.
It is on Classic Developement, Weapons, -System/Trading.

I have put "//" in front of the deletestring command.
The following six lines are what fixed it. (I rescripted the deletestring command).
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #6  
Old 12-02-2002, 03:14 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by Com013
I don't want to publish it here.
It is on Classic Developement, Weapons, -System/Trading.

I have put "//" in front of the deletestring command.
The following six lines are what fixed it. (I rescripted the deletestring command).
nice 6 lines :o
__________________

Reply With Quote
  #7  
Old 12-02-2002, 03:37 AM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Quote:
Originally posted by CheeToS2


nice 6 lines :o
What do you mean? I published those six lines in my start post of this thread.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #8  
Old 12-02-2002, 11:07 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
Arg you are using 'temp' ? that will send a lot of data to the player x-x And it still doesnt tell me what should be wrong. A code example of the bug would be good
Reply With Quote
  #9  
Old 12-03-2002, 03:28 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by Com013

What do you mean? I published those six lines in my start post of this thread.
Oh.. you said the following 6 lines.. but they didn't follow that text.. so
__________________

Reply With Quote
  #10  
Old 12-03-2002, 05:23 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally posted by Stefan
Arg you are using 'temp' ? that will send a lot of data to the player x-x
Well, you could always code the server so it does not send data to the client which it cannot read/edit anyways.
Reply With Quote
  #11  
Old 12-04-2002, 11:43 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Quote:
Originally posted by Stefan
Arg you are using 'temp' ? that will send a lot of data to the player x-x And it still doesnt tell me what should be wrong. A code example of the bug would be good
Ok, now I am using this.temp, but we are going off-topic here.
Tyhm told me sometime that only LATs are allowed to see the scripts used on Classic, so I won't post it here, but, like I wrote before, you can look at it on Classic Developement, it's in the -System/Trading weapon.
(I tried sending it to you using a PM, but it was 10 times too huge for a forum PM).

However, this is a very short version of it:
NPC Code:

if (actionserverside) {
hatnum = strtofloat(#p(0));
putnpc2 playerx,playery+2,{join hats;};
with (npcs[npcscount-1]) {
this.hat = strtofloat(#I(clientr.hats,hatnum));
deletestring clientr.hats,hatnum; // <- always delets #0
callnpc -1,updategani;
}
}
//#CLIENTSIDE
if (weaponfired) triggeraction 0,0,serverside,DeleteTest,2;



Quote:
Originally posted by CheeToS2
Oh.. you said the following 6 lines.. but they didn't follow that text
No, I meant the following six lines in the script and not in my post.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #12  
Old 12-04-2002, 11:49 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally posted by Com013
NPC Code:

if (actionserverside) {
hatnum = strtofloat(#p(0));
putnpc2 playerx,playery+2,{join hats;};
with (npcs[npcscount-1]) {
this.hat = strtofloat(#I(clientr.hats,hatnum));
deletestring clientr.hats,hatnum; // <- always delets #0
callnpc -1,updategani;
}
}
//#CLIENTSIDE
if (weaponfired) triggeraction 0,0,serverside,DeleteTest,2;

Variables like those are local to a certain NPC.
Reply With Quote
  #13  
Old 12-04-2002, 11:56 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Quote:
Originally posted by Loriel

Variables like those are local to a certain NPC.
They don't start with this., so NO!

And:
NPC Code:

with (npcs[npcscount-1]) {
this.hat = strtofloat(#I(clientr.hats,hatnum)); // <- this works
deletestring clientr.hats,hatnum; // <- this doesn't
}

__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #14  
Old 12-05-2002, 12:05 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Personally I just wouldn't use a string array, though it depends on how many of each hat you want to allow people to have. If you use ascii() and #K() then you can compact numbers over a fairly large range into a single byte, and then just use a normal string with one character per hat.
__________________
Reply With Quote
  #15  
Old 12-05-2002, 12:21 AM
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
Variables like hatnum are local, belonging to the current script, so you can use hatnum like you have written, and it works. You have problems when calling functions of joined classes, because those don't know of the local variables of the other script.
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 12:46 PM.


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