Store text in a variable

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Store text in a variable

Postby drummerac » Sat Oct 31, 2009 11:40 pm

I want players to enter their name so that I can display:

"your name" has scored "X" amount of points etc.

The only information I can find on this in the forum is for password fields.

Does anyone know how to do this in version 4.5.2?

There is a solution posted for an earlier version but it wont work on version 4.5.2.

Thanks in advance :)
User avatar
drummerac
Member
 
Posts: 53
Joined: Fri Apr 10, 2009 5:07 pm
Location: Ireland

Postby reneuend » Sun Nov 01, 2009 5:29 am

You can use the textboxobject or an inputbox to get the user's name.


Code: Select all
name = inputbox("Enter your name please", "Name", "")



The textboxobject is a bit more involved in set up, but the nice thing about it is that it isn't a popup. The user enters their name in a field, and then clicks on a hotspot. when they click on a hotspot, you can capture the text in the field and store it in a variable.

Note: You will want to unload the textboxobject before going to another frame, or it will still be there!

Code: Select all
'building the field
loadcontrol textboxobject(1)
textboxobject(1).move 100*15,100*15,300*15,20*15
textboxoject(1).visible = true



Code: Select all
'Hotspot button to capture text from field
name = textboxobject(1).text


Code: Select all
'hotspot that takes the user to a different screen
unloadcontrol textboxobject(1)
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby drummerac » Sun Nov 01, 2009 7:37 pm

thanks reneuend,

I think Ill stick with the input box as it looks simpler but now it wont store the text in the variable :(

If I could figure out getting the game to store the variables to a text file, then Id be laughing, but I think Ill settle for a screenshot of the end result, that is what the username is for, so I can tell the difference between each user :)
User avatar
drummerac
Member
 
Posts: 53
Joined: Fri Apr 10, 2009 5:07 pm
Location: Ireland

Postby reneuend » Mon Nov 02, 2009 3:18 am

I'm not sure what you mean it won't save the text to a variable. Are you talking about the inputbox?

As for saving to a text file, it's very simple. I'll build a tutorial this week...you should see it in the next few days....stay tuned.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby mercedes » Thu Nov 05, 2009 10:58 am

drummerac wrote:thanks reneuend,

I think Ill stick with the input box as it looks simpler but now it wont store the text in the variable :(

If I could figure out getting the game to store the variables to a text file, then Id be laughing, but I think Ill settle for a screenshot of the end result, that is what the username is for, so I can tell the difference between each user :)


If u go to Shadow Hunters website...he has a demo script there of an Imput box..that u can download..it might help..:D

http://www.shadowhunter.co.uk/index1.html

First hit the link that says VBscripts on the side..That is where u see it listed..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron