Author Topic: Take off the _ from a name?  (Read 1589 times)

I need to remove the _ off the front of a bricks name when calling getName();

For example echo(%brick.getName()); for a brick named John would result in _John

How can I make it echo just John?

%name=%brick.getName();

%name=strReplace(%name,"_","");

this will change all _ in the string, into nothing and will return John.

u can change it into different things, for ex:

%name=strReplace(%name,"_","*");

that will return *John

Thanks big time! :D

Tom

Using strReplace won't work for a brick named something like this: John_House
Use getSubStr(%brickName, 1, strlen(brickName) - 1); instead.

getSubStr(%brickName, 1, strlen(%brickName) - 1);
Fiks'd. :3

Alright. Thanks! :D

One more thing:

What is the usage of getTrustLevel()?

Tom

It returns the trust level between two objects.

example: getTrustLevel(%brick, %client)

0 is no trust
1 is build trust
2 is full trust
3 is the "owner" trust

It returns the trust level between two objects.

example: getTrustLevel(%brick, %client)

0 is no trust
1 is build trust
2 is full trust
3 is the "owner" trust

Oh that makes so much more sense. Thank you!

Well, not just between brick and client.
Can be any combination between: bricks, clients, players, vehicles, and not sure about projectiles.

Well, not just between brick and client.
Can be any combination between: bricks, clients, players, vehicles, and not sure about projectiles.

Cool :3

MOAR QUESTION!!

For some reason, I will use setName to change the name of a brick, but when I use an event, such as onactivate>namedbrick(Nameofbrickchanged)>disappear>5

It will do absolutely nothing. Is there something I need to refresh?

MOAR QUESTION!!

For some reason, I will use setName to change the name of a brick, but when I use an event, such as onactivate>namedbrick(Nameofbrickchanged)>disappear>5

It will do absolutely nothing. Is there something I need to refresh?
You'll have to mess around with the brick's brickgroup.

You'll have to mess around with the brick's brickgroup.

Eh... I don't have any idea. :I

You'll have to mess around with the brick's brickgroup.

No. Don't try talking about things you know nothing about; it only confuses people.

Use this:

Code: [Select]
if(%name $= "")
     %brick.setName("");
else
     %brick.setNTObjectName(%name);

No. Don't try talking about things you know nothing about; it only confuses people.

 :cookieMonster: