Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   #t() help (https://forums.graalonline.com/forums/showthread.php?t=46641)

Benm00t 07-30-2003 09:54 PM

#t() help
 
How can I have all the tokens after a certain token be shown?

What i mean is, after #t(1), i want all the tokens to be shown along with that, but because the amount of tokens is always changing, i just can't add more #t(). Is there a character i can add with #t() so it knows to show all the tokens after it, or will i need to put it into a loop..

Thought 07-30-2003 10:38 PM

The variable tokenscount should help, make a for loop that appends the rest of the tokens to a string, for example.

Alexander 07-30-2003 11:02 PM

Quote:

Originally posted by Thought
The variable tokenscount should help, make a for loop that appends the rest of the tokens to a string, for example.
You could use #e so you won't have to use a loop, and indexof like indexof(#t(2),#c).

Projectshifter 07-31-2003 08:46 AM

Arg, did I ever tell you how much you people scare me?!
This is an example that will take something if you chat, and sendtorc #t(1) up to #t(i) =) This is the MOST efficent way ;)
NPC Code:

if (playerchats){
tokenize #c;
sendtorc #t(1) - #t(1) = #T(#e(strlen(#t(0)),-1,#c));
}


Short, sweet, and to the point =)
#e (as alex said) is the best way, but all you have to do is have it do the string length. Plus #T removes spaces at the beginning =D
---Shifter

Kaimetsu 07-31-2003 09:03 AM

It's usually foolish to proclaim that your method is the most efficient, especially in a language like GScript. It's impossible to know for sure since we don't know how Graal works internally, and you run the risk of somebody saying something like:

Hey dorkface, that only works if spaces are the only delimiters.

Projectshifter 08-01-2003 05:39 AM

LOL, point taken Kai. But to the best of my knowledge, that is the most efficient way ;)
And if you're using another delimiter, it should be self explanatory ;)
---Shifter


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

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