Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new optional parameter to dbg_text_input() to be able to modify the type of input (string, int, real) #2738

Closed
GameDevTosh opened this issue Dec 18, 2023 · 4 comments
Assignees
Labels
feature request New feature (or a request for one)
Milestone

Comments

@GameDevTosh
Copy link

Is your feature request related to a problem?

Currently there seems to be no way to input a number to change a variable with directly with the debug functions. We can change them with dbg_slider_int(), but the slider will not let us pick an exact number in the middle if we need one (slider does not increase by 1's, seems to go up by sporadic numbers).

We also have dbg_drop_down(), but we would have to hard code values to pick from. There is also dbg_text_input(), which is close to what I want/need, but it only returns a string, with no option to convert it to a real before setting it to the variable.

The IMGUIGML extension, which Nomms IMGUI is inspired from, has an imguigml_input_int(), which allows us to input a value to set variables to. Something like this is what I'm hoping can be added.

Describe the solution you'd like

A dbg_real_input() function to be able to set variables to directly with real or integer values, not just strings.

Describe alternatives you've considered

Currently I use IMGUIGML, but I wanted to remake my debug menu using GM's new dbg functions to also have access to the graphs/logs available with the debug overlay, along with my own custom debug menu. This doesn't seem completely possible at this current time.

Additional context

Here is how this looks with IMGUIGML, and I can set a custom value of 2000000000 for gold, among other things.
debug

@GameDevTosh GameDevTosh added the feature request New feature (or a request for one) label Dec 18, 2023
@rwkay
Copy link

rwkay commented Dec 18, 2023

Just an FYI - you can type a direct value into an ImGUI slider by using CTRL+click within the slider - this will allow you to type the number in directly to get exact values.

@GameDevTosh
Copy link
Author

Just an FYI - you can type a direct value into an ImGUI slider by using CTRL+click within the slider - this will allow you to type the number in directly to get exact values.

Yes thank you for mentioning that! This should definitely be mentioned in the manual as well.

@rwkay
Copy link

rwkay commented Dec 21, 2023

Feature added in 2024.2 - modified function dbg_text_input so that the type of input can be set as an optional third parameter - type to store value as, default is string, use "s" or "t" for string, use "i" or "d" for integer, use "f", "r" or "g" for real

so to limit to only integers you can use the following code.

foo = 10;
var rf = ref_create( self, "foo" );
dbg_text_input( rf, "Hello", "i" );

NOTE: Hex and Binary numbers are handled for integers i.e. 0xcafebabe or 0b1010101

@rwkay rwkay closed this as completed Dec 21, 2023
@iampremo iampremo transferred this issue from another repository Jan 9, 2024
@rwkay rwkay added this to the 2024.2 milestone Jan 10, 2024
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Jan 11, 2024
YoYoGames/GameMaker-Bugs#2738
* Updated the dbg_text_input function page with the new info
* Added a copy-pastable, thoroughly explained second code example
* Added a note to the Data Types page to refer to the typeof function
@Emc1923
Copy link

Emc1923 commented Jan 12, 2024

Verified parameter type added in Beta IDE v2024.200.0.461 Beta Runtime v2024.200.0.477

@Emc1923 Emc1923 changed the title Add a dbg_real_input() function to be able to change reals Add a new optional parameter to dbg_text_input() to be able to modify the type of input (string, int, real) Jan 12, 2024
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Jan 19, 2024
…to modify the type of input (string, int, real)

YoYoGames/GameMaker-Bugs#2738
* Clarified the line that the text field accepts and converts hexadecimal and binary literal values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature (or a request for one)
Projects
Archived in project
Development

No branches or pull requests

3 participants