I have read about 40 posts where xeroblood replied and read menu tutorials, but I have a specific question on how a certain part of a plugin works.
I am trying to understand how exactly the atac menu for atac_cfg plugin changes ON to OFF and vice versa.
Code:
new option = get_cvar_num("atac_options")
format(smenu, 63, "%L\R1/2", id, "MENU_CFG_PTITLE")
format(menuoption[0], 63, "\w1. %L\R\y%s^n", id, "MENU_CFG_SLAP", (option & (1<<0)) ? "ON" : "OFF")
1. I do not understand \R1/2 or what it does ???
2. I do not understand \R because \r is for red but what is \R ???
I understand that (1<<0) is key 1. I understand that it is checking to see if (1<<0) is a bit in option which is get_cvar_num("atac_options") which is = to 8183 in the atac.cfg file.
I do not see how it is checking the cvar to know whether to change the menu to display ON or OFF because I do not see how Key 1 is represented by the slap cvar.
Does this mean it is checking if Key 1 is a bit in 8183? Could someone explain this so I can understand it?
I also do not understand the ? after (option & (1<<0)) or the : between "ON" and "OFF". Are they operators? I do not understand what exactly they are and what exactly they do.
Does the ? mean to check if (option & (1<<0)) is true and then if it is true display "ON" and if false display "OFF"?
If someone could explain this code and how that works that would help me out.
Edit:
Thank you for the below explanations I appreciate it everyone.