Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Param Problem (https://forums.graalonline.com/forums/showthread.php?t=34047)

darkriders_p2p 07-23-2002 04:33 AM

Param Problem
 

Hey, i got this problem with params when using tokenize, could someone explain why these params are read as 0?

NPC Code:

//from another part of the script:
setstring server.hammerresources,sand,0,wood,25,ore,15;
setstring client.makeweapon,hammer;
tokenize #s(server.#s(client.makeweapon)resources);
//end
if (strtofloat(#t(3))>0){
this.recsneeded++;
if (strtofloat(#s(client.wood))>=strtofloat(#p(3))){
this.ok++;
setstring client.wood,#v(strtofloat(#s(client.wood))-strtofloat(#p(3)));
}else setplayerprop #c,You dont have enough recourses!;
}
if (strtofloat(#t(5))>0){
this.recsneeded++;
if (strtofloat(#s(client.ore))>=strtofloat(#p(5))){
this.ok++;
setstring client.ore,#v(strtofloat(#p(5)));
}else setplayerprop #c,You dont have enough recourses!;
}


darkriders_p2p 07-23-2002 08:51 PM


yea, that would probably be smarter...
sometimes Im a bit dumb:rolleyes:

One thing though, i didn't find any answer to this in newfeatures2001.txt so;
How do i set a stringarray with all its values in one command, like with normal arrays: array={1,2,3,7};
Is it possible? or do i have to type in a bunch of addstring commands?

screen_name 07-23-2002 09:58 PM

setstring name,stuff,bla,blue,niceguy;

you read from the array like this

NPC Code:

#I(arrayname,index);



remember, indexes start with 0
so #I(arrayname,0) would be 'stuff'

darkriders_p2p 07-23-2002 10:09 PM


yea i know that, i just thought it should be like
setstring strarray,"1""45""text";
but i was wrong, again...


All times are GMT +2. The time now is 07:03 AM.

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