This conditional is wrong? - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: This conditional is wrong? (/Thread-This-conditional-is-wrong) |
This conditional is wrong? - pushim - 04-07-2015 08:12 PM ON=@DCLICK REF1=<UID> IF ((<SRC.VAR0.TEST1>) == ((<REF1.P.X>),(<REF1.P.Y>))) // some actions here ELIF ((<SRC.VAR0.TEST2>) == ((<REF1.P.X>),(<REF1.P.Y>))) //some actions here ELIF ((<SRC.VAR0.TEST3>) == ((<REF1.P.X>),(<REF1.P.Y>))) //some actions here ENDIF This is my problem, this conditional can't compare the value of VAR with X,Y coordinates and execute the line inside of IF, but the values are not equal and don't execute the others ELIF Help the newbie :c RE: This conditional is wrong? - azmanomer - 04-07-2015 09:14 PM use strmatch('<src.var0.test1>','<p.x>,<p.y>') RE: This conditional is wrong? - pushim - 04-08-2015 08:26 PM Console error :/ ERROR:Undefined symbol '' RE: This conditional is wrong? - XuN - 04-09-2015 04:54 PM First: SRC WILL NEVER have VARS, since vars are server handled and var.test1 will be the same to every item/player/gm/npc/house/whatever, so there's no reason to use src.var*. Second: You have to compare one string at each time, 150,110 (in example) are 2 so you can separate them and compare in 2 checks or use str* intrinsic functions. Using STR*: if (strcmpi("<var0.test1>","<p.x>,<p.y>")==0)// == 0 means, in a simple explanation, 0 differences ... so a total match. if (strmatch("<var0.test1>","<p.x>,<p.y>")==1)// this one should work too Separating args: You first need a function to get each argument Code: [FUNCTION argvx] Then you have to use it in your code like this: if (<argvx 0,<var0.test1>>==<p.x> && <argvx 1,<var0.test1>>) RE: This conditional is wrong? - pushim - 04-13-2015 02:02 AM I use vars to check that the values are well, i'm newbie in the sphere, in the language programmation and in englishman i will try to make it work, thx xun |