Player Naming System (updated)

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

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

Player Naming System (updated)

Postby Lyberodoggy » Fri Feb 22, 2008 7:34 am

A player naming system can get a game closer to the player... He can give the actor his own name or nickname, giving him the possibility to live the adventure.

All you have to do is create a variant variable and get the player fill it with his name of choice. Then you can use it to display his score, make other actors call him with this name or even create on-line scoreboards and automatically transfer his score and nickname there (well that's a little bit complex, but can be done if the developer has knowledge on SQL and plenty of time)

Here's a sample project (well, there's a bug I couldn't repel, but it is gonna work)
Attachments
name.rar
It's created with AM 4.3 but it's gonna work in all versions since 3.x as far as I know...
(98.74 KiB) Downloaded 571 times
Last edited by Lyberodoggy on Wed Oct 14, 2009 8:23 pm, edited 1 time in total.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby GM-Support » Fri Feb 22, 2008 4:42 pm

sounds nice! thanks for posting it!
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Lyberodoggy » Fri Feb 22, 2008 4:50 pm

My pleasure to be of help :lol:
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Fri Feb 22, 2008 7:41 pm

Here's a project in which your score is stored in a .ini file in your computer, using your name... I have to apologise for its imperfection (It can't display more than one score though it stores more than that and it still doesn't "remember" which was the last entry but it can be fixed)
Attachments
scoreboards.rar
(106.35 KiB) Downloaded 471 times
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Sat Feb 23, 2008 8:35 pm

That's pretty good.
_________________
what is global recession
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:11 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Sun Feb 24, 2008 11:09 am

I 've already fixed the problem of not remembering the last entry (by adding one more entry in the INI file) and when the scoreboard problem is fixed I will upload the new version :lol:
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Tue Feb 26, 2008 7:59 pm

My only problem with INI files is that they're too easy to change, you could easily just manually change your score.

The only way I guess is to make the file Read-Only, or encrypt it, but then again, AM wouldn't be able to access it.
_________________
make personal budget
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:12 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Tue Feb 26, 2008 8:12 pm

Yeah, right. But if you have Adventure Maker write them with another extention, then even if the player finds them, he may not know that they can be opened using notepad. To do so, just change the WriteINI command like this:
Code: Select all
Action.WriteINI yourinifile.yourextention,index,parameter,value
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Tue Feb 26, 2008 8:16 pm

Yeah... :?

It's a good idea, but it's not ENTIRELY secure. I need a way to hide the files, but have the AM engine still able to access them.
_________________
mortgage bailout
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:12 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Tue Feb 26, 2008 8:23 pm

So... We need a miracle :P



Or the GMs help :lol:
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Tue Feb 26, 2008 8:24 pm

A miracle... that's just great!!! :D

Where am I gonna get one of those?
_________________
Ford Wiki
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:12 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Tue Feb 26, 2008 8:26 pm

:lol:
Like "Unplug and Pray" :lol: :lol: :lol:
BTW, here's the version which stores the number of the entries:
Attachments
scoreboards.rar
New version, now storing the number of the entries
(106.6 KiB) Downloaded 477 times
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Sun Mar 02, 2008 8:29 am

As for the miracle we were talking about:
You can create a simple encoding program (search for source codes or tutorials in the Internet), then use the OpenExeFileAndWait command to start it in runtime and have it coding and decoding the .ini file, so that only AM is able to read it.



Difficult,huh?

Then wait for the miracle, I'm done with coding for at least a week :lol:
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Tue Mar 04, 2008 8:37 pm

Miracles do happen! :)

(Not often enough though)
_________________
Religion Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:12 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Tue Mar 11, 2008 6:59 pm

Well, I was thinking of fixing this tutorial so I dig up the old project and modifyied it. Looks much better now...
Here is the modifyied source code of the scoreboard system:
After creating a global integer variable called Score and one called INIKey, type this in the hotspot the player has to click to save his score
Code: Select all
If Score=0 Then
MsgBox "You can't save your score If it's 0"
Else
Name=InputBox("Your Name or Nickname","Score")+cstr(": ")
INIKey=INIKey+1
Action.WriteINI "ScoreBoard.ini",2,1,INIKey
Action.WriteINI "ScoreBoard.ini",1,INIKey,Name + " " + cstr(Score)
Action.GoToFrame "Scoreboard"
End If

where Scoreboard should be replaced with the internal name of the frame where your scoreboard will be placed.
Go to the scoreboard frame.
In the frame's properties type this code:
Code: Select all
entries=INIKey
Text(1).Caption=Scoreboard
Do
Text(1).Caption=Text(1).Caption+Action.ReadINI("ScoreBoard.ini",1,entries)+vblf
entries=entries-1
Loop While entries>0


where Text(1) should be replaced if there's another text with that index. Create a text with the caption "Scoreboard" and place it where you want the scoreboard to appear.
To create a "Clear Scoreboard" button, enter these lines in the hotspot you will use:
Code: Select all
If INIKey>0 Then
Answer=MsgBox("Are you sure?",vbyesno)
If Answer=vbyes Then
Do
Action.WriteINI "ScoreBoard.ini",2,1,""
Action.WriteINI "ScoreBoard.ini",1,INIKey,""
INIKey=INIKey-1
Loop While INIKey>0
Action.GoToFrame "Scoreboard"
End If
Else
MsgBox "The Scoreboard is already empty"
End If


Now one thing is left: go to Project Properties and in "Advanced", in the "Execute VBS every time a frame is loaded" field paste these:
Code: Select all
INIKey=ConvertToNumber(Action.ReadINI("ScoreBoard.ini",2,1))

Hope you like this one!
Attaching the modifyied sample...
Attachments
scoreboards.rar
Fixed once again! Added Clear scoreboard & Multi-line scoreboard!!!
(106.95 KiB) Downloaded 497 times
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Candle » Tue Mar 11, 2008 7:45 pm

Know what would be nice to add to this.
let the users add an avatar next to the score.
So when the score shows it has their picture/avatar next to it.
say 100x100 or something like that.
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: 3055
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Lyberodoggy » Tue Mar 11, 2008 7:52 pm

Thanks candle, I will try, though it is unsupported by the ini method... Maybe I will use the External folder to save those avatars...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Tue Mar 11, 2008 8:36 pm

Well I kinda tried it Candle, but both the Common Dialog and Createobject functions, which should help are disabled and there's no commondialogobject. I think only GM could help us.


I 'm getting this error message when trying to create a common dialog:
WARNING! The VBScript code makes calls to the "CreateObject" function, which for security reasons is not allowed.
Please remove the calls to that function and try again
.

Unless we can do something to make the common dialog work (which will be used to browse the avatar), I 'll have to create a collection of ready avatars and have the player select among them (which normally requires also the common dialog).
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Candle » Tue Mar 11, 2008 8:53 pm

Code: Select all
Action.LoadAPicture Hotspot(HOTSPOT_NUMBER), "FILENAME"


Code: Select all
Hotspot(5).MouseIcon = LoadGraphicFile("FILENAME")
   Hotspot(5).MousePointer = 99


Code: Select all
SaveAPicture     Saves a graphic from the "Picture" or "Image" property of an object or control (such as a PictureBox) into a BMP file. The syntax is:

     Action.SaveAPicture CONTROLNAME,"FILENAME"

where CONTROLNAME is the name of the object or control that contains the picture to save and FILENAME is the name of the output BMP file.
SaveParameter    Saves the value of a parameter to the Windows registry (use this command in conjunction with the Action.LoadParameter command). The syntax is:

     Action.SaveParameter "PARAMETER_NAME", VALUE

where PARAMETER_NAME is the name of the parameter (for example, "NumberOfTrialDaysLeft"), and VALUE is the value of the parameter (for example 30 to indicate that there are 30 trial days left)


http://www.adventuremaker.com/help/vbsc ... erence.htm
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: 3055
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Lyberodoggy » Tue Mar 11, 2008 8:56 pm

I know those Candle... I have read them at least 100 times. But what I wanted is a Common Dialog which enables the player to browse through his images and pictures saved in his local drive, then select one and use that as an avatar.
Anyway, thanks.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby GM-Support » Wed Mar 12, 2008 5:57 pm

Maybe ShadowHunter's CommonDialog plugin for Adventure Maker will do the job:
http://www.shadowhunter.co.uk/index1.html
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Lyberodoggy » Wed Mar 12, 2008 6:00 pm

Thanks GM I 'll check on it...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Wed Mar 12, 2008 6:21 pm

Well it's exactly what I need, but I 've not registered Keyguard... Is it needed to use the plugin or just for the demo included?
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby laserman » Mon Apr 14, 2008 5:45 pm

I was trying to use this example to have the player name dis-played in a position of my choice.... alas.... I'm at a loss as to how to do this. This is what I did (according to what I am seeing in this post):

Name=InputBox("Type your name", "Name")

Then, after the variable "Name" is set, I want to have it displayed in an area where I drew a box. So I looked at your code and see that you basically used a Text Box (aka HotSpot) to do that. I tried that, but it appears that I have 2 choices.... display the text at the bottom of the screen, or in a pop up box. This is all the Hotspot properties will allow me to do. So I'm wondering how I would accomplish this feat? Obviously there's some VB script that I need to input, and try as I might I couldn't figure it out.

Thanks.
laserman
Member
 
Posts: 16
Joined: Fri Mar 21, 2008 6:06 pm

Postby Lyberodoggy » Mon Apr 14, 2008 6:27 pm

A TextBox is not a hotspot... a textboxobject is the standard VB TextBox control, loaded on AM using this line:
Code: Select all
loadcontrol TextBoxObject(index)



What you need to use is an AM text (VB Label).
Create a blank frame.
Right click the area you want the name to appear, write something (doesn't matter what it is since it will not be displayed as-is).
Merge it with the frames you need the name to appear.
Go to every frame that displays the name and paste this code:
Code: Select all
i=Action.GetMergedTextIndex
Text(i).Caption=Name


If this doesn't solve your problem, create a sample of what you are trying and upload it for me to check it...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby laserman » Tue Apr 15, 2008 4:29 pm

Ok, I give in.
:oops:
Here is an example of what I did. While I can enter the name, it won't display after I enter it. I kept it as simple as possible so it wouldn't be huge.

Thanks for your help as always.
Attachments
lasercolor.zip
(96.31 KiB) Downloaded 533 times
laserman
Member
 
Posts: 16
Joined: Fri Mar 21, 2008 6:06 pm

Postby Chromegloss55 » Tue Apr 15, 2008 7:24 pm

Just like to say this whole topic has been very informative and very worthwhile. But one thing I've noticed is that people don't seem to have a great grasp of vb objects, in particular the textbox.

So techniques 10 - 15 of my VB Techniques are focussed on that in particular. I will release them next tuesday (or sooner depending on when I can get online), and I think (and hope) that it will make things very clear in relation to textboxes.

It's a bit off topic, but I think it's relevant because if you understand textboxes, then you'll probably be able to use a player naming system a lot better. (Also, I think textboxes aren't explained in great enough detail in the AM Help Guide).

Sorry, for my... advertising... keep up the good work. :D
_________________
household budget
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:13 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Tue Apr 15, 2008 9:05 pm

No need to apologise... your work really helps people.

Edit: I found your problem laserman. You haven't used an index for the text. The right code in your case is
text(1).caption=name
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby laserman » Wed Apr 16, 2008 2:49 pm

I was wondering Lyberodoggy...
could you point out exactly where I am to change this? I tried both spots where this statement shows up and still it will not display the "name" I type in. Or perhaps you could fix it, then upload it for me to look at?

Most likely it is something simple, but I am just not getting it. Sorry.
:oops:
laserman
Member
 
Posts: 16
Joined: Fri Mar 21, 2008 6:06 pm

Postby Lyberodoggy » Wed Apr 16, 2008 3:40 pm

You should look through your code... That would help you understand how it works and help you with learning VBS (it helped me anyway)

You must use the code I gave you in the frame's advanced of the frame that has the name displayed.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Next

Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron