SphereCommunity
Playing with String - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Playing with String (/Thread-Playing-with-String)



Playing with String - Catalan_mistral - 02-12-2017 10:29 PM

Ok snippet of code causing me a little problem

Code:
<STREAT <Tag0.<ARGS>.value>>

Is there a way to make this snippet return 0 if the tag doesn't exist?

I've tried

Code:
<STREAT 0<Tag0.<ARGS>.value>>

but if the tag returns for example 10, the result is 010, hence evaluating it then returns 16.


RE: Playing with String - Catalan_mistral - 02-13-2017 05:31 AM

Ok I will answer my own question here lol

Solved using UVAL

Code:
<UVAL <STREAT <Tag0.<ARGS>.value>>>

Passes 0 if the tag is non existent


RE: Playing with String - Anarch Cassius - 02-15-2017 08:43 AM

Good job.

I was gonna recommend a QVAL but your way is clearly more elegant.


RE: Playing with String - Catalan_mistral - 02-15-2017 11:19 AM

LoL well i'm a builder, and have no real coding/scripting skill apart from what I have picked up from sphere, so a lot of the time it is more luck than anything else if it works Smile