IF constructs: Selection of multiple objects or numbers - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: General Help (/Forum-General-Help) +--- Thread: IF constructs: Selection of multiple objects or numbers (/Thread-IF-constructs-Selection-of-multiple-objects-or-numbers) |
IF constructs: Selection of multiple objects or numbers - Kyrbis - 06-21-2012 05:45 AM Hi there. I have problems with some IF constructs, as i simply don't get it how to select multiple numbers for an argument. I know it has to be simple, but...i don't get it ^^ Here's an example of what i want to do: ON=@SpellCast IF <SRC.ISGM> RETURN 0 ELIF <ARGN1>== (spell number one to spell number 16 for example) MESSAGE This is beyond your Rank. RETURN 1 ENDIF So, if I want to select Spell 1 and 2, might it be ELIF <ARGN1>== 1 || <ARGN1>== 2 || and so on? or can i simplify it anyways? I want to hold it simple for learning and very basic scripting, but seems i need some help here :/ RE: IF constructs: Selection of multiple objects or numbers - Anarch Cassius - 06-21-2012 07:12 AM Look up the programming concept Comparisions http://en.wikipedia.org/wiki/Comparison_(computer_programming) So we could actually do this... Code: <ARGN1> == 1 || <ARGN1> == 2 || <ARGN1> == 3 || <ARGN1> == 4 ... Those || mean OR so this works. But a quick glance at that link should show there's a better way. Code: <ARGN1> < 17 RE: IF constructs: Selection of multiple objects or numbers - Kyrbis - 06-21-2012 08:11 AM As I read it, and tried....math is simply logical. Haven't thought of using this comparison, while it is so simple and compact. Thanks alot ^^ RE: IF constructs: Selection of multiple objects or numbers - xwerswoodx - 06-21-2012 08:13 AM (06-21-2012 07:12 AM)Anarch Cassius Wrote: This is better one But if you use complex; for example 1,6,12,60 etc you can use this Code: [function f_seperator] and in-code Code: for 1 <f_seperator 0,<def.asd>> |