Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Space remove function? (https://forums.graalonline.com/forums/showthread.php?t=76547)

Kyranki 08-28-2007 05:07 PM

Space remove function?
 
Out of curiosity, is there a function that removes all the spaces within a sentence? I couldn't find one looking through the wiki. o.o

xXziroXx 08-28-2007 05:10 PM

Nope.

Chompy 08-28-2007 05:20 PM

make one yourself? :p

Kyranki 08-28-2007 05:31 PM

Too bad, guess I'll have to make one as Chompy said. :P

bscharff 08-29-2007 03:10 AM

I'm Going To Assume You Want To Automatically Remove The Spaces From The Player's Chat:

PHP Code:


function onPlayerChats(){
 
tokens player.chat.tokenize();
 
player.chat tokens[1tokens[2tokens[3tokens[4tokens[5tokens[6tokens[7tokens[8tokens[9tokens[10];


Not Tested, But Should Work :P

Angel_Light 08-29-2007 03:17 AM

Quote:

Originally Posted by bscharff (Post 1344429)
I'm Going To Assume You Want To Automatically Remove The Spaces From The Player's Chat:

PHP Code:


function onPlayerChats(){
 
tokens player.chat.tokenize();
 
player.chat tokens[1tokens[2tokens[3tokens[4tokens[5tokens[6tokens[7tokens[8tokens[9tokens[10];


Not Tested, But Should Work :P

I believe you need this

PHP Code:

function onPlayerChats(){
 
tokens player.chat.tokenize();
 
player.chat tokens[1] @ tokens[2] @ tokens[3]...;



Kyranki 08-29-2007 03:24 AM

Quote:

Originally Posted by bscharff (Post 1344429)
I'm Going To Assume You Want To Automatically Remove The Spaces From The Player's Chat:

PHP Code:


function onPlayerChats(){
 
tokens player.chat.tokenize();
 
player.chat tokens[1tokens[2tokens[3tokens[4tokens[5tokens[6tokens[7tokens[8tokens[9tokens[10];


Not Tested, But Should Work :P

I don't need to seperate the players chat. o.o And you didn't properly declare that variablep properly. Besides I was hoping there was a general function for removing the spaces from any line of text.

xXziroXx 08-29-2007 06:08 AM

PHP Code:

temp.txt "I love f'ing rock'n'roll!";
for (
temp.footemp.txt.tokenize()) temp.txt2 = (temp.txt2 == NULL temp.foo temp.txt2 temp.foo);
player.chat temp.txt2


zokemon 08-30-2007 06:50 AM

Quote:

Originally Posted by xXziroXx (Post 1344473)
PHP Code:

temp.txt "I love f'ing rock'n'roll!";
for (
temp.footemp.txt.tokenize()) temp.txt2 = (temp.txt2 == NULL temp.foo temp.txt2 temp.foo);
player.chat temp.txt2


PHP Code:

temp.txt2 = (temp.txt2 == NULL temp.foo temp.txt2 temp.foo); 

Is the same thing as just:

PHP Code:

temp.txt2 @= temp.foo

You should always initialize the variable prior to the for loop so you don't accidentally use the variable beforehand and not even realize it.


All times are GMT +2. The time now is 12:17 AM.

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