SphereCommunity
speech - Printable Version

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

Pages: 1 2


speech - Art - 08-20-2012 07:21 AM

Code:
[spk_player]

ON=**

tag.key = <args>

If somebody will use symbols like /, server will give message about error 'Exp_GetVal: Divide by 0', or = + -, server will give messages like 'Undefined symbol'.

How i can solve problem?


RE: speech - Extreme - 08-20-2012 07:48 AM

on=*
try this


RE: speech - Art - 08-20-2012 08:55 PM

Same thing =\


RE: speech - Shaklaban - 08-20-2012 08:57 PM

its bug of a sphere, its tries to evaluate everything. you can block this characters in speech.

im also have that problem. sometimes i want to use db.escapedata function on speech, but strings are evalauted even with insde " ".


RE: speech - Skul - 08-20-2012 11:33 PM

Ah ya, mathematical algorithms do that everytime you compare one using a statement. (IF/ELSEIF/WHILE/FOR/etc). You can work around it by converting the characters to <ASC> and storing into a LOCAL, compare the LOCAL in your statements and return <ARGS> as you need to (after all comparisons are complete).


RE: speech - Art - 08-20-2012 11:38 PM

May i ask for example please?

I tried
local.str = <args>

it contain error too. I need record speech string to 'tag' on character.


RE: speech - Skul - 08-20-2012 11:51 PM

sure
Code:
[FUNCTION char_parse]
LOCAL.ARGS=<ARGS>x
WHILE (<EVAL <STRPOS -1 <STRSUB -1 1 <LOCAL.ARGS>> <LOCAL.ARGS>> +1> >= <dLOCAL.X>)
    LOCAL.ASC=<ASC <STRSUB <dLOCAL.X> 1 <LOCAL.ARGS>>>
    IF (<LOCAL.ASC>==022) || (<LOCAL.ASC>==023) || (<LOCAL.ASC>==025) || (<LOCAL.ASC>==026) || (<LOCAL.ASC>==027) || (<LOCAL.ASC>==028) || (<LOCAL.ASC>==029) || (<LOCAL.ASC>==02A) || (<LOCAL.ASC>==02B) || (<LOCAL.ASC>==02C) || (<LOCAL.ASC>==02D) || (<LOCAL.ASC>==02F) || (<LOCAL.ASC>==03C) || (<LOCAL.ASC>==03D) || (<LOCAL.ASC>==03E) || (<LOCAL.ASC>==05E) || (<LOCAL.ASC>==07C) || (<LOCAL.ASC>==07E)
        IF (STRMATCH(<LOCAL.RETURN>,0))
            LOCAL.RETURN=<ASC <STRSUB <dLOCAL.X> 1 <LOCAL.ARGS>>>
        ELSE
            LOCAL.RETURN=<LOCAL.RETURN><ASC <STRSUB <dLOCAL.X> 1 <LOCAL.ARGS>>>
        ENDIF
    ELSE
        IF (STRMATCH(<LOCAL.RETURN>,0))
            LOCAL.RETURN=<STRSUB <dLOCAL.X> 1 <LOCAL.ARGS>>
        ELSE
            LOCAL.RETURN=<LOCAL.RETURN><STRSUB <dLOCAL.X> 1 <LOCAL.ARGS>>
        ENDIF
    ENDIF
    LOCAL.X += 1
ENDWHILE
RETURN <STRSUB 0 <EVAL <EVAL STRLEN(<LOCAL.RETURN>)> +-1> <LOCAL.RETURN>>
So with this, you would use is like so:
Code:
[speech spk_player]
on=*
local.args=<char_parse <args>>
if (strmatch(<local.args>,test))
say=<args>
endif
It's just a quick work around, if you want to compare math algorithms using strmatch you can do something like:
Code:
local.args=<char_parse <args>>
local.cmp=<char_parse />
if (strmatch(<local.args>,<local.cmp>))
say=compared.
endif



RE: speech - Art - 08-21-2012 12:56 AM

Woah, much code for small problem =\


RE: speech - Extreme - 08-21-2012 01:14 AM

I still do not understand your problem...


RE: speech - Shaklaban - 08-21-2012 01:33 AM

[spk_player]
ON=**
tag.key = <args>


just put that on speech than in game write something like: 0/0 etc. you will see his problem on console Big Grin sphere tries to calculate player speech which is must be a string, not integer. when we can assign the args we can use " " but when sphere assign args we can't do much.