Page 1 of 2

Characters counter

Posted: Tue Apr 03, 2018 3:37 pm
by thevisionisdivine
Hi.

For a community, it would be great (since it's a game) to have something which counts post characters.
I know there's a "word count" but, while nice, it's useless for me...
Has anybody an idea?

Thanks

Re: Characters counter

Posted: Tue Apr 03, 2018 9:06 pm
by GanstaZ
You are the one who is requesting an extension). We don't know what do you want to do & what would be the purpose?!)

Re: Characters counter

Posted: Wed Apr 04, 2018 3:46 pm
by thevisionisdivine
GanstaZ wrote:
Tue Apr 03, 2018 9:06 pm
You are the one who is requesting an extension). We don't know what do you want to do & what would be the purpose?!)
I am sure I wrote it: counting characters in a message.
Before a quest starts (it's a sci-fi RPG) we will say something like: "Ok players: for this quest, the minimum post length is 600 chars".
Following this, the quest will start and players will post a message, according to the players rotation set.
At the end, the post should show the post character count, which will we'll use to compute the points earned (using something similar to NCAA passer rating formula).

Is it enough?

Re: Characters counter

Posted: Wed Apr 04, 2018 4:43 pm
by GanstaZ
Yes.. this is much better. Counting chars isn't complicated, but the main point here is: Is it for one go or for masses.?

Re: Characters counter

Posted: Wed Apr 04, 2018 6:25 pm
by thevisionisdivine
GanstaZ wrote:
Wed Apr 04, 2018 4:43 pm
Is it for one go or for masses.?
What do you mean?

Re: Characters counter

Posted: Wed Apr 04, 2018 9:13 pm
by GanstaZ
I mean, is it only for one person (the one who requested) or for many (are there more people who want something like this for their board).

Re: Characters counter

Posted: Wed Apr 04, 2018 11:41 pm
by thevisionisdivine
It's for my board. How I know if somebody else's board needs it?

Re: Characters counter

Posted: Wed Apr 04, 2018 11:42 pm
by thevisionisdivine
It's for my board. But, if it works, we will try it, first of all, on another board I take part in...

Re: Characters counter

Posted: Thu Apr 05, 2018 6:28 pm
by ViolaF

Re: Characters counter

Posted: Thu Apr 05, 2018 8:55 pm
by thevisionisdivine
I know that. But it's not an extension and I'm not going to study german...

Re: Characters counter

Posted: Wed Apr 11, 2018 12:24 pm
by thevisionisdivine
???

Re: Characters counter

Posted: Wed Apr 11, 2018 7:07 pm
by ViolaF
thevisionisdivine wrote:
Thu Apr 05, 2018 8:55 pm
and I'm not going to study german...
of course not :D

http://php.net/manual/en/function.strlen.php

Re: Characters counter

Posted: Wed Apr 11, 2018 7:12 pm
by 3Di
strlen() returns the number of bytes rather than the number of characters in a string.
Say you have multiple Emojis (4-bytes) or similar issues, you are not really done.

See instead http://php.net/manual/en/function.iconv-strlen.php and follow.

Also http://php.net/manual/en/function.mb-strlen.php could come in handy.

Re: Characters counter

Posted: Wed Apr 11, 2018 7:32 pm
by ViolaF
of course mb ;)

Re: Characters counter

Posted: Wed Apr 11, 2018 7:35 pm
by 3Di
ViolaF wrote:
Wed Apr 11, 2018 7:32 pm
of course mb ;)
That's slower/intensive than the others, you should really find a compromise, maybe coding a sort of function instead.