Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tokens and Strings - A Problem (https://forums.graalonline.com/forums/showthread.php?t=46326)

Chris1Polly 07-20-2003 01:23 AM

Tokens and Strings - A Problem
 
Well Ive got a doosie of a problem this time. Ive tried everything I can think of to come up with a way to tokenize a string, add another string to a certain token, then putting the string in place again. [its for stackable items in a custom inventory - that bypasses the normal graal inventory] This is what I have, well theres more but this is the part that has the error I think. Am I going about this wrong? Or can it not be done... though I would think it can, considering Ive not slept in a few days I cant think straight >_<! Thanks in advance to anyone who can help!
NPC Code:

if (created){
setstring this.type,barbedarrow;
setstring this.maxstack,100;
setstring this.stack,100;
setstring this.icon,server-ammotest.gif;
setstring this.pierce,0;
setstring this.slash,0;
setstring this.magic,0;
setstring this.blunt,0;
setstring this.cold,0;
setstring this.shock,0;
setstring this.acid,0;
setstring this.fire,0;
setimgpart #s(this.icon),7,2,31,31;
setstring this.free,1;
}
if (playertouchsme){
tokenize #s(client.ammo(#s(this.free)));
if (strequals(#t(1),#s(this.type))){
setstring this.current,#t(3);
if (strtofloat(#t(3))<strtofloat(#t(2))){
setstring client.ammo#s(this.free),#s(this.icon),#s(this.typ e),#s(this.maxstack),#v(strtofloat(#s(this.current ))+strtofloat(#s(this.stack))),#s(this.pierce),#s( this.slash),#s(this.magic),#s(this.blunt),#s(this. cold),#s(this.shock),#s(this.acid),#s(this.fire);
destroy;
}
}
}


protagonist 07-20-2003 01:33 AM

The line
tokenize #s(client.ammo(#s(this.free)));

doesn't seem to make sense. What you are doing is getting a single token from that, not a token*value. Also, I don't know why you have #s(this.free) nested in the #s for client.ammo(perhaps it's something I've never heard of, I don't know.).

CheeToS2 07-20-2003 01:38 AM

I just glanced at the script & noticed the same thing..

if you have a string called this.free, and you have another string called client.ammo<whatever this.free currently is>, you'd do
#s(client.ammo#s(this.free))

Chris1Polly 07-20-2003 01:38 AM

explaining
 
oops LOL e.e well I feel dumb, figured it was something simple. Thanks guys time for a nap methinks.. my brain is fried


All times are GMT +2. The time now is 05:32 PM.

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