REKT Posted June 15, 2016 Group: Members Topic Count: 24 Topics Per Day: 0.00 Content Count: 206 Reputation: 11 Joined: 12/06/11 Last Seen: September 13, 2024 Share Posted June 15, 2016 (edited) Hi, if there is anybody who can help me solved my issue since i couldn't find any resources in script_commands.txt So: // itemcheck(<itemid>{,<charid>}) return 1 if the item is usable and wearable on attached character, or on specific charid on argument 2 else return 0 Please drop me a PM. Edited June 15, 2016 by Keysito Quote Link to comment Share on other sites More sharing options...
0 Secrets Posted June 16, 2016 Group: Developer Topic Count: 36 Topics Per Day: 0.01 Content Count: 588 Reputation: 438 Joined: 01/26/16 Last Seen: Friday at 12:08 PM Share Posted June 16, 2016 You can use getiteminfo command and compare the job bitmask with player's job. Quote Link to comment Share on other sites More sharing options...
0 REKT Posted June 16, 2016 Group: Members Topic Count: 24 Topics Per Day: 0.00 Content Count: 206 Reputation: 11 Joined: 12/06/11 Last Seen: September 13, 2024 Author Share Posted June 16, 2016 Okay, thanks for pointing out. I'll give a try. Can i ask for example of bitmask? Thank you. Quote Link to comment Share on other sites More sharing options...
0 Kurofly Posted June 16, 2016 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted June 16, 2016 (edited) There is a great example of bitmasks use in the script commands, it's pretty simple and useful: The bitwise operator AND (&) is used to test two values against each other, and results in setting bits which are active in both arguments. This can be used for a few things, but in rAthena this operator is usually used to create bit-masks in scripts. The bitwise operator OR (|)sets to 1 a binary position if the binary position of one of the numbers is 1. This way a variable can hold several values we can check, known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0 to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks that a player can have. A bit-mask basically is (ab)using the variables bits to set various options in one variable. With the current limit if variables it is possible to store 32 different options in one variable (by using the bits on position 0 to 31). Example(s): - Basic example of the & operator, bit example: 10 & 2 = 2 Why? : 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010 2 = 2^1 (2), so in bits (same size) it would be 0010 The & (AND) operator sets bits which are active (1) in both arguments, so in the example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit 0010, which is 2. - Basic example of creating and using a bit-mask: set @options,2|4|16; //(note: this is the same as 2+4+16, or 22) if (@options & 1) mes "Option 1 is activated"; if (@options & 2) mes "Option 2 is activated"; if (@options & 4) mes "Option 3 is activated"; if (@options & 8) mes "Option 4 is activated"; if (@options & 16) mes "Options 5 is activated"; I guess you'd have to edit the 'getiteminfo' script command in order to get the job type of items Job: Which jobs this item is available for. Values below can be combined to achieve availability for multiple job classes, i. e. 0x2|0x4 -> 0x6 (Swordman+Mage) (S.) Novice (2^00): 0x00000001 Swordman (2^01): 0x00000002 Mage (2^02): 0x00000004 Archer (2^03): 0x00000008 Acolyte (2^04): 0x00000010 Merchant (2^05): 0x00000020 Thief (2^06): 0x00000040 Knight (2^07): 0x00000080 Priest (2^08): 0x00000100 Wizard (2^09): 0x00000200 Blacksmith (2^10): 0x00000400 Hunter (2^11): 0x00000800 Assassin (2^12): 0x00001000 Unused (2^13): 0x00002000 Crusader (2^14): 0x00004000 Monk (2^15): 0x00008000 Sage (2^16): 0x00010000 Rogue (2^17): 0x00020000 Alchemist (2^18): 0x00040000 Bard/Dancer (2^19): 0x00080000 Unused (2^20): 0x00100000 Taekwon (2^21): 0x00200000 StarGladiator (2^22): 0x00400000 Soul Linker (2^23): 0x00800000 Gunslinger (2^24): 0x01000000 Ninja (2^25): 0x02000000 Gangsi (2^26): 0x04000000 Death Knight (2^27): 0x08000000 Dark Collector (2^28): 0x10000000 Kagerou/Oboro (2^29): 0x20000000 Rebellion (2^30): 0x40000000 All Classes : 0xFFFFFFFF Every Job Except Novice : 0xFFFFFFFE This way you'd be able to use bitmasks with the 'BaseJob' player variable and so telling if the item is wearable by the player. Edited June 16, 2016 by Kurofly Quote Link to comment Share on other sites More sharing options...
Question
REKT
Hi, if there is anybody who can help me solved my issue since i couldn't find any resources in script_commands.txt
So:
Please drop me a PM.
Edited by KeysitoLink to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.