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 07-20-2003, 01:23 AM
Chris1Polly Chris1Polly is offline
Registered User
Chris1Polly's Avatar
Join Date: Feb 2002
Location: A place without hate
Posts: 44
Chris1Polly is on a distinguished road
Send a message via AIM to Chris1Polly
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;
}
}
}

__________________
Reply With Quote
  #2  
Old 07-20-2003, 01:33 AM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
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.).
Reply With Quote
  #3  
Old 07-20-2003, 01:38 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
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))
__________________

Reply With Quote
  #4  
Old 07-20-2003, 01:38 AM
Chris1Polly Chris1Polly is offline
Registered User
Chris1Polly's Avatar
Join Date: Feb 2002
Location: A place without hate
Posts: 44
Chris1Polly is on a distinguished road
Send a message via AIM to Chris1Polly
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
__________________
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 08:41 PM.


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