Jump to content
  • 0

Q> On Bitmask


Question

Posted

 

	//   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?
 

5 answers to this question

Recommended Posts

  • 0
Posted
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.

 

  • Upvote 1
  • 0
Posted

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

 

  • Upvote 1
  • 0
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...