SphereCommunity
Counting Steps - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: Counting Steps (/Thread-Counting-Steps)



Counting Steps - DartHVirS - 01-27-2018 03:42 AM

Hello guys, I was trying to make a script that counts every step of all users.

I tried different things without success.

For example...

Code:
[FUNCTION f_CountSteps]
IF !(<eval <tag0.stepp>> == <eval <p>>)
tag.steps=<tag0.steps> + 1
tag.stepp = <p>
timerf 1,f_CountSteps
ELSE
timerf 1,f_CountSteps
ENDIF

This works fine if the player walks in X direction... but does not work when the player walks in Y direction.

I couldn't get to work comparing two player positions.

Any ideas?

Thank you.


RE: Counting Steps - Soulless - 01-27-2018 05:09 AM

You could use something like this, you could specify a distance it must be and fire the trigger of in the amount of seconds that length of travel would take, but it would be inaccurate to the exact amount of steps. as it is now it's accurate for boy x+y


Code:
[function steps_count]
tag0.steps += <distance <tag0.old_loc>>
tag0.old_loc=<p>
timerf 1,steps_count
return <dtag0.steps>



RE: Counting Steps - DartHVirS - 01-27-2018 06:00 AM

Thank you Soulless, but I need it to be more accurate.

How can I compare two player positions?

I tried with string functions but when they read the position comma they do not read anything after that comma.

For example STRMATCH(<p>,<p>) for example if <p> is equal to "804,600,0" that function only reads the first number before the comma "804". Is any string function that can erase the comma or something?, that would really help with my function.

OK, It is working now. What I did is the following:
Code:
[FUNCTION f_CountSteps]
local.p1 = <STRARG <p>>
local.p2 = <STRARG <STREAT <p>>>

IF (<tag0.stepp1> != <local.p1>) || (<tag0.stepp2> != <local.p2>)
tag.steps=<tag0.steps> + 1
tag.stepp1 = <STRARG <p>>
tag.stepp2 = <STRARG <STREAT <p>>>
timerf 1,f_CountSteps
ELSE
timerf 1,f_CountSteps
ENDIF



RE: Counting Steps - darksun84 - 01-27-2018 11:00 AM

You can access the multiple values of p by using <p.x> <p.y> <p.z> and <p.m>


RE: Counting Steps - DartHVirS - 01-27-2018 01:03 PM

(01-27-2018 11:00 AM)darksun84 Wrote:  You can access the multiple values of p by using <p.x> <p.y> <p.z> and <p.m>

OOhhh I forgot that!!! hahaha. Thank you