![]() |
DOSWITCH - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: General Help (/Forum-General-Help) +--- Thread: DOSWITCH (/Thread-DOSWITCH) |
DOSWITCH - pointhz - 05-30-2016 08:21 AM Just a question I cant figure out myself and couldnt find in the wiki. How can I use the DOSWITCH function? Thanks in advance RE: DOSWITCH - Vaikin - 05-30-2016 08:58 AM Theres an example in the wiki, should be pretty clear. Code: ON=@TargOn_Ground RE: DOSWITCH - Coruja - 05-30-2016 04:19 PM DOSWITCH is like an switch to select an specific pre-defined line on the code Code: DOSWITCH 3 of course it doesn't make sense use an fixed switch like this example, because if we always want the line 3, it makes more sense use directly "SYSMESSAGE Message 3" instead an useless DOSWITCH with many results but always returning the same fixed result 3 so DOSWITCH is usefull on situations where you already have some pre-defined lines and want trigger the correct line based on some other value, like this: Code: DOSWITCH <DIR> //this return an 0-7 value based on the direction your char is facing in other words, DOSWITCH does the same thing as this code below but using an clean/optimized code Code: IF (<DIR>==0) RE: DOSWITCH - pointhz - 05-31-2016 05:29 AM Thanks a lot Coruja ![]() Thanks for your answer too Vaikin. I'd seen that example already but couldnt figure out how the DOSWITCH function was picking the SYSMESSAGE xD If I look at the wiki example now I can figure it out. CanSeeLos returns either 0 or 1 and then it will pick either the first line or the second in the DOSWTICH. Makes sense, but it's not easy to find out unless you think about DOSWITCH picking a line by their order based on numbers. |