Player Input & Display

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

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

Player Input & Display

Postby Merrie » Fri Dec 07, 2007 9:34 pm

I would like to add the following feature to my game and have reviewed the FAQ and such and cannot quite figure out how to go about it.

On the introduction of the adventure I would like the player to be able to put in a character name, then periodically throughout the adventure, the name they selected will appear in the text.

Thank you ahead for the help.

:)
User avatar
Merrie
Member
 
Posts: 29
Joined: Fri Mar 16, 2007 3:53 pm

Postby Candle » Fri Dec 07, 2007 11:31 pm

You cold use ini read and write.
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby GM-Support » Sat Dec 08, 2007 5:52 am

Hi Merrie,

As an alternative to using ini files, you can also use the "LoadParameter" and "SaveParameter; commands (more info here).

However, both the ini files and the two other commands have the drawback that the information is stored on the computer. Therefore, if you have multiple players playing the game on the same computer, they will share the same name. Furthermore, with those methods, the information is not stored in the savegames (saving the information in savegames can be useful for resuming the game on another computer for example).


There is another method, which solves those problems and which is very simple:

1. Just create a global variable of type "variant" (to do so, click "VBS Global Variables" from the Adventure Maker Project Menu). Give a name to the variable (for example, call it "CharacterNameVariable").

2. Ask for the character name with the following code:
Code: Select all
CharacterNameVariable = InputBox("Please enter the name of the character.")


3. To reuse the name in your game, just use the variable. For example, if you have a text element on the frame, you can display the name by using the following code:
(updated on July 14, 2008)
Code: Select all
Text(1).Caption = CharacterNameVariable

Or, if you want to display a message box, just use:
Code: Select all
MsgBox "The character name is: " + CharacterNameVariable



The global variable will be automatically stored in the savegames.

Best regards,
GM-Support
Last edited by GM-Support on Mon Jul 14, 2008 7:06 pm, edited 1 time in total.
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby ZeornWarlock » Mon Dec 24, 2007 4:29 am

Very useful info! :)

ZW.
User avatar
ZeornWarlock
Expert Member
 
Posts: 347
Joined: Tue Jun 05, 2007 12:52 am
Location: In front of the monitor.

Postby ZeornWarlock » Sat Jul 12, 2008 10:31 pm

Hi guys,

This code works...

Code: Select all
  CharacterNameVariable = InputBox("Please enter the name of the character.")


This code also works...

Code: Select all
MsgBox "The character name is: " + CharacterNameVariable


This however, does not...

Code: Select all
Text(0).Caption = CharacterNameVariable


Ironically, the last one is the code I need! :( I have tested everything and made sure the variable was right etc... However, weather I put text on a frame or if I put text in a hotspot, nothing happens. The description is also a bit vague to be honest.

3. To reuse the name in your game, just use the variable. For example, if you have a text element on the frame, you can display the name by using the following code:

So if I have this text...

Hi there, and my coded word "Jack" is the CharacterNameVariable

Will this look like the following?

Hi there, Jack.

What happens if I want "Jack" to appear between more lines like the following...

Hi there, Jack. How are you?

Thanks.

ZW.
You have to make some to understand some.
User avatar
ZeornWarlock
Expert Member
 
Posts: 347
Joined: Tue Jun 05, 2007 12:52 am
Location: In front of the monitor.

Postby Lyberodoggy » Sun Jul 13, 2008 10:36 am

Create a text by right clicking in the frame and write abc in it.
use the code
Code: Select all
text(1).caption="Hi there"+CharacterNameVariable+"How are you?"
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby ZeornWarlock » Sun Jul 13, 2008 10:41 pm

Lyberodoggy wrote:Create a text by right clicking in the frame and write abc in it.
use the code
Code: Select all
text(1).caption="Hi there"+CharacterNameVariable+"How are you?"


Thanks for the help, however I get this error now...
Attachments
AM Script error.jpg
AM Script error.jpg (56.9 KiB) Viewed 4581 times
You have to make some to understand some.
User avatar
ZeornWarlock
Expert Member
 
Posts: 347
Joined: Tue Jun 05, 2007 12:52 am
Location: In front of the monitor.

Postby mercedes » Mon Jul 14, 2008 10:09 am

I don't know if this applies here..and I could be way off base...



Frame properties

Code: Select all
Text(1).caption="text"+vblf+"text"
---same text as on the frame..more text keep adding vblf in between plus signs..


tested and it worked for me..Hope I understand what you mean. Add character name varialble where u want it in between texts..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby ZeornWarlock » Mon Jul 14, 2008 12:17 pm

Lyberodoggy, okay your code works. While testing, I forgot to trigger the variable from the other frame. :oops:

mercedes, yours worked too. Thanks.

However, I am not sure anymore where I am going with this. I wanted to replace the Conversation Wizard, with text caption. Now that I own the full version, I find the conversation wizard so limited. I really hope GM-Support will take a deeper look of a Conversation Editor I sent him in the past.

Anyhow, the codes will still be of use, but not for an alternative conversation maker. :?

ZW.
You have to make some to understand some.
User avatar
ZeornWarlock
Expert Member
 
Posts: 347
Joined: Tue Jun 05, 2007 12:52 am
Location: In front of the monitor.

Postby Lyberodoggy » Tue Jul 15, 2008 12:23 pm

User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron