AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved % char in menu (https://forums.alliedmods.net/showthread.php?t=310706)

marcelowzd 09-16-2018 10:39

% char in menu
 
I know It'll sound as a stupid question but How can i show the % character in a menu? I Tried escaping It with ^% or Just passing % directly and didn't work

menu_additem( hMenu, "test %", "", 0 );
menu_additem( hMenu, "test ^%", "", 0 );

JocAnis 09-16-2018 10:52

Re: % char in menu
 
will format/formatex change anything ?

marcelowzd 09-16-2018 10:55

Re: % char in menu
 
Quote:

Originally Posted by JocAnis (Post 2615421)
will format/formatex change anything ?

The menu i'm building actually uses formatex, so no

E1_531G 09-16-2018 11:10

Re: % char in menu
 
Try: %%

marcelowzd 09-16-2018 12:52

Re: % char in menu
 
Quote:

Originally Posted by E1_531G (Post 2615426)
Try: %%

This is the answer, thanks.

fysiks 09-16-2018 16:11

Re: % char in menu
 
The code that you actually posted shouldn't have any issues because that function doesn't do any formatting. If it really is having that issue, it is a bug. If you are using a function that is actually formatting a string (e.g. format() or formatex()) then %% is the proper solution.

So, if "menu_additem( hMenu, "test %", "", 0 );" doesn't work, you need to report it as a bug.

If you are using format or formatex, you should update your original post to show that because as it stands this thread doesn't make any sense.

HamletEagle 09-17-2018 03:54

Re: % char in menu
 
Quote:

Originally Posted by fysiks (Post 2615465)
The code that you actually posted shouldn't have any issues because that function doesn't do any formatting. If it really is having that issue, it is a bug. If you are using a function that is actually formatting a string (e.g. format() or formatex()) then %% is the proper solution.

So, if "menu_additem( hMenu, "test %", "", 0 );" doesn't work, you need to report it as a bug.

If you are using format or formatex, you should update your original post to show that because as it stands this thread doesn't make any sense.

+1
menu_additem(hItem, "test %") works properly. Next time you should post the actual code that you have issues with.

marcelowzd 09-17-2018 12:41

Re: % char in menu
 
Quote:

Originally Posted by fysiks (Post 2615465)
The code that you actually posted shouldn't have any issues because that function doesn't do any formatting. If it really is having that issue, it is a bug. If you are using a function that is actually formatting a string (e.g. format() or formatex()) then %% is the proper solution.

So, if "menu_additem( hMenu, "test %", "", 0 );" doesn't work, you need to report it as a bug.

If you are using format or formatex, you should update your original post to show that because as it stands this thread doesn't make any sense.

You're right, i'm using formatex as answered previously to jocAnis but i should've said in the First post.

Thanks everyone.

SomewhereLost 09-17-2018 16:28

Re: % char in menu
 
While we are here, is there a way to show % from a .txt file?

klippy 09-17-2018 19:05

Re: % char in menu
 
Quote:

Originally Posted by SomewhereLost (Post 2615599)
While we are here, is there a way to show % from a .txt file?

The question doesn't make sense. What are you trying to do? Also better open another topic and provide more info, it's really a different question.


All times are GMT -4. The time now is 23:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.