PsyOps Posted January 23 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 150 Reputation: 11 Joined: 12/03/18 Last Seen: 8 hours ago Share Posted January 23 // 1: Reward 1 | 2: Reward 2 | 4: Reward 3 // Sets Basic List of Rewards .RewardList = 1|2|4; In this example, the variable .RewardList = 7; Is there a way to detect how many rewards are there on this variable using bitmask? Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted February 3 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10015 Reputation: 2357 Joined: 10/28/11 Last Seen: Saturday at 06:48 PM Share Posted February 3 On 1/24/2024 at 9:54 PM, PsyOps said: Is there an existing script_command that will allow me to produce the value '2' as it includes reward 1 and 2. that's not how bitmask work. dont want it work this way? then change the whole thing, and not to use bitmask. .RewardList = 1|2; // include only reward 1 and 2 using bitmask, this is the way to get reward 1 and 2. 1 Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted January 24 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10015 Reputation: 2357 Joined: 10/28/11 Last Seen: Saturday at 06:48 PM Share Posted January 24 3 rewards. .RewardList = 1; // include only reward 1 .RewardList = 1|2; // include only reward 1 and 2 .RewardList = 1|4; // include only reward 1 and 3 .RewardList = 2|4; // include only reward 1 and 3 .RewardList = 2|4; // include only reward 2 and 3 .RewardList = 4; // include only reward 3 1 Quote Link to comment Share on other sites More sharing options...
0 PsyOps Posted January 24 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 150 Reputation: 11 Joined: 12/03/18 Last Seen: 8 hours ago Author Share Posted January 24 Probably my question needs to be rephrased. Lets say that the value of the .RewardList = 3; Is there an existing script_command that will allow me to produce the value '2' as it includes reward 1 and 2. its kind of like getting the array size of the bitmask value. I hope i am asking it right but thanks @Emistry for the reply. Quote Link to comment Share on other sites More sharing options...
0 botka4aet Posted January 24 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 211 Reputation: 17 Joined: 12/23/11 Last Seen: June 11 Share Posted January 24 set .@valve,0; if (.@options & 1) .@valve++; if (.@options & 2) .@valve++; if (.@options & 4) .@valve++; mes .@valve; Quote Link to comment Share on other sites More sharing options...
0 PsyOps Posted February 8 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 150 Reputation: 11 Joined: 12/03/18 Last Seen: 8 hours ago Author Share Posted February 8 Thanks for the answer @Emistry. Quote Link to comment Share on other sites More sharing options...
Question
PsyOps
In this example, the variable .RewardList = 7;
Is there a way to detect how many rewards are there on this variable using bitmask?
Link to comment
Share on other sites
5 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.