Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AGK Product Chat / Text input

Author
Message
Doveyy04
User Offline
Joined: 30th Apr 2012
Location:
Posted: 16th May 2012 13:11
In the example "Text input" it prints the text that you type in at the top of the screen because the command is just print text$ , but how do you print the (text$) in a different location, style etc? I've tried doing Createtext (1, text$) then settextlocation etc but it's not printing it where I want it. Does it have to be as a Createtext command or can you locate Print to be in a certain place colour style etc like in old Basic
Ancient Lady
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th May 2012 16:05
Have a cruise around the documentation for Text: http://www.appgamekit.com/documentation/Reference/Text.htm

After you use CreateText (and save the returned id for other commands), you may need to make sure that it's depth is above any background objects and you can position it anywhere you want in the display.

Cheers,
Ancient Lady
Mobiius
AGK Developer
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 16th May 2012 16:53
Print just displays text from the top of the screen down. To position text, you'll need to createtext and settextposition to display it elsewhere.

(Think of print as debug only, and the proper text commands as final version ones)

I live for video games! (And beers, and football, and cars!)
Doveyy04
User Offline
Joined: 30th Apr 2012
Location:
Posted: 16th May 2012 19:50
tried settextdepth but text not printing at all, ive even tried clearing the screen after text input but it doesnt clear. How do I put a copy of my program on here as a clipit so people can view it and see where I have gone wrong???
Ancient Lady
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th May 2012 23:11
You can either upload the entire zipped project (use the 'Browse' button in the 'Post Forum Message' dialog).

Or you can put just the code in a code bit using the 'code' buttons:
+ Code Snippet

Cheers,
Ancient Lady
TonytheTiger
User Offline
Joined: 14th May 2012
Location:
Posted: 17th May 2012 00:22
I can't get textinput to work either. How hard can it be to enter 4 values into 4 variables. I know the code below is wrong it is only like the 100th idea I have come up with. The documentation is not clear to me on this. Does the gettextinput work in a loop to build a string. What I would give for a input statement. Any ideas all. thanks


Starttextinput ()
who$ = GetTextInput ( )
StopTextInput( )
Starttextinput ()
what$ = GetTextInput ( )
StopTextInput( )
Starttextinput ()
where$ = GetTextInput ( )
StopTextInput( )
Starttextinput ()
save$ = GetTextInput ( )
StopTextInput( )
Ancient Lady
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th May 2012 16:18
It appears that you aren't using the commands quite right.

This is the AGK example (ignoring the background image/sprite):
+ Code Snippet

The commands are not called sequentially. StartTextInput() opens the input box and then the app keeps rolling. You then have to keep checking to see if the input was completed, then you can get the value.

Cheers,
Ancient Lady
TonytheTiger
User Offline
Joined: 14th May 2012
Location:
Posted: 18th May 2012 02:01
Thanks Ancient lady,

I know how to do one entry in a loop. I need to enter about 6 values into a table. I have the table/array and saving to a file done.

Can not seem to be able to input values. I am not understanding getextinput. The documentation doesn't really say much more than show the same example your showing.

I need to something like
input a$,b$,c$

or anything else that I can do data entry with.
DVader
User Offline
Joined: 28th Jan 2004
Location:
Posted: 18th May 2012 02:27
Your programming style reminds me of a friends program many years back I'm sure you will get into loops and such pretty quick.
Try this to alter text. I have modified the above example with a couple of lines.
+ Code Snippet

TonytheTiger
User Offline
Joined: 14th May 2012
Location:
Posted: 18th May 2012 03:07
I guess you don't understand. I need to enter multiple items. You code only enters one entry then it prints it. I need to ask player
Name
Age
Character Name
and location

How do I do this, I seem to only be able to enter one value in loop.
If I add multiple gettextinput they don't work.

I can do this in any other language in one or two lines.
Funnell7
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 18th May 2012 15:37 Edited at: 18th May 2012 15:40
There may be a much better way of doing this, but this seems to work:

+ Code Snippet

In this example I'm using the 'Print' command but you could easily change this to a 'CreateText' instead... You will obvioulsy need to add some text so the user knows what you are asking them to update, and you may want to put a check in to ensure they have actually updated some info before moving on to the next stage...
Ancient Lady
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th May 2012 16:23
You might also want to look at the EditBox functions.

The example in Text->Editboxes shows how to put up multiple boxes and customize them. I would highly recommend commenting out the SetEditBoxScissor line before compiling and running. I don't know why anyone would need such a command (but I could be very wrong).

Going with the simpler edit box (the first one) is probably enough.

You can create a page with Text objects as prompts above appropriate edit boxes and have a button to press when all the input is done.

Cheers,
Ancient Lady
Ancient Lady
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th May 2012 17:21 Edited at: 18th May 2012 17:24
Try variants of this:
+ Code Snippet

Yes, it could be done differently. This was just hashed together quickly.

Cheers,
Ancient Lady

Login to post a reply

Server time is: 2016-08-24 06:40:15
Your offset time is: 2016-08-24 06:40:15