2015-03-06 15:21:02

Hello everyone,

As you might know i am developing an audiogame called your_adventure. but what i want to know, how can i add a edit field where the players can fill out an amount of gold to bet for the gambling kobolt? and when the player wins that it will be doubled? and if the amount of gold the player wants to bet while they haven't enough gold how can i check this with this code?
what line in bgt do i need for this idea? when i know this i can use it to also update the shop, the fisherman etc.

thanks in advance.

greetz mike

Visit the following website to see what games we have:
http://www.nonvisiongames.com
Or the following English marketplace to see what retrogames and game merchandise I am selling:
https://www.retro-kingdom.com

2015-03-06 17:33:52

audio_form, or input_box?
If I need to avoid using input_box (say, because it would break a network connection), I'd probably write my own text edit function out of shere not-feeling-like-it with those that already exist.
But there are plenty out there.

Just use string_to_number on the result.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-03-06 22:19:41

hi cae

this system is rather new to me, but i want to make use of the input_box method. and i thought the string_to_number method is also needed for this. but more than this i don't know.
can you please write an example piece what i can study?

thanks a lot.

greetz mike

Visit the following website to see what games we have:
http://www.nonvisiongames.com
Or the following English marketplace to see what retrogames and game merchandise I am selling:
https://www.retro-kingdom.com

2015-03-06 23:14:52

The main problem is: you can't block your entire game waiting for a player input, or the network connection will fail. The audio form is a non-blocking system with a unique audio_form class, which simulates real forms smile

This class only handle the "form part" : you have to set the default values of fields, etc.
The simple BGT example of the BGT help for input_box is:

#include "form.bgt"

audio_form form;

void main()
{
form.create_window("Example Form", true);
int name=form.create_input_box("&Name");
int password=form.create_input_box("&Password", "", "*");
int message=form.create_input_box("&Message", "This is a read only input box.", "", 0, true);
int ok=form.create_button("OK");
int cancel=form.create_button("E&xit");
while(true)
{
form.monitor();
wait(5);
if(form.is_pressed(ok))
{
exit();
}
if(form.is_pressed(cancel))
{
exit();
}
if((key_down(KEY_LMENU))&&(key_pressed(KEY_F4)))
{
exit();
}
}
}

This is a useless code but you can look at it to understand how it works. The BGT help explains almost everything about the audio form class. The main problem is : how to focus all player controls on this form, without blocking the program in something like a loop, which would break the network connection? That's what you really have to think about I think smile

2015-03-06 23:43:11

If you don't need a network connection, input_box should be fine.
string text=input_box("Number", "enter a number:");
int number=string_to_number(text);

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-03-07 16:16:45

hi,

thanks for the info cae_jones. that as exactly what i needed.

also many thanks for all the ohters who replied.

greetz mike

Visit the following website to see what games we have:
http://www.nonvisiongames.com
Or the following English marketplace to see what retrogames and game merchandise I am selling:
https://www.retro-kingdom.com