Alice Community  

Go Back   Alice Community > Alice 2 > Share Objects

Reply
 
Thread Tools Display Modes
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 02-11-2012, 04:23 PM

Quote:
Originally Posted by Dj Tech42 View Post
Can you use the author string to make profiles? (separate variables for every user playing the game)
I would prefer you didn't.

The author variable is your (the creators) name/nickname, the game title is the title of the game.
Any other way and saves could get mixed up.

If you want to create game profiles for different users then you can. When you use the save_var method you get a name parameter. This can have any value, it doesn't have to relate to the var parameter at all, but for the sake of keeping it simple I suggest you do make it relate somehow.

Because it can have any value, you can request a username from the user or work out some other way of identifying each user and getting a unique string out of it for their profile. You can then simply join the username and the string you would have set the name parameter to. I suggest joining them with a "." in the middle.

eg. If I entered my username as "Arty-fishL" and the name being used to identify the variable being saved was "score" then the value to use as the name parameter for the save_var method would be:
"Arty-fishL.score"
Or if my username was "Dj Tech" it would be:
"Dj Tech.score"

Does that make sense?
Take a look at my attached example that uses the eg
Enter a username
Press green to increase your score
Red to reset it
Restart the world and enter the same name, your score will load
Try it with different names
Attached Files
File Type: a2w SaveTool User Profiles Example.a2w (481.3 KB, 6 views)


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]

Last edited by arty-fishL; 02-11-2012 at 04:29 PM.
   
Reply With Quote
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 202
Join Date: Feb 2011
Default 02-11-2012, 04:33 PM

Quote:
Originally Posted by arty-fishL View Post
I would prefer you didn't.

The author variable is your (the creators) name/nickname, the game title is the title of the game.
Any other way and saves could get mixed up.

If you want to create game profiles for different users then you can. When you use the save_var method you get a name parameter. This can have any value, it doesn't have to relate to the var parameter at all, but for the sake of keeping it simple I suggest you do make it relate somehow.

Because it can have any value, you can request a username from the user or work out some other way of identifying each user and getting a unique string out of it for their profile. You can then simply join the username and the string you would have set the name parameter to. I suggest joining them with a "." in the middle.

eg. If I entered my username as "Arty-fishL" and the name being used to identify the variable being saved was "score" then the value to use as the name parameter for the save_var method would be:
"Arty-fishL.score"
Or if my username was "Dj Tech" it would be:
"Dj Tech.score"

Does that make sense?
Take a look at my attached example that uses the eg
Enter a username
Press green to increase your score
Red to reset it
Restart the world and enter the same name, your score will load
Try it with different names
Basically all I need is a function that returns the joined string and a variable to keep track of the username? Wow, it's a lot easier than I thought.

I guess I don't think as much in a programming sense when I'm using Alice. If I was using Java, I would have figured it out quickly. But, I forgot that you could return things in Alice. Thanks.


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 03-09-2012, 10:06 AM

So this tool has come out at the right time, I am going to try to use this and the world loader tool with the Legend of Zelda game I am currently making, if it was to be one Alice world, it definitely would have been way to big and laggy


If you are stuck on a project, check out the tutorials I made here at this link:

http://alice.org/community/showthread.php?p=36778#post36778

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..

http://www.youtube.com/user/sfunk1992?feature=mhsn
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 03-23-2012, 08:38 AM

So for some reason I cannot use the tool to save number variables, it won't give me the option, I got the string save to work just fine?

Never mind, I didn't realize that you had to manually type in the name of the number variable instead of being able to use the drop down menu like you can with a string.


If you are stuck on a project, check out the tutorials I made here at this link:

http://alice.org/community/showthread.php?p=36778#post36778

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..

http://www.youtube.com/user/sfunk1992?feature=mhsn

Last edited by sfunk; 03-23-2012 at 08:47 AM.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 03-23-2012, 10:52 AM

Quote:
Originally Posted by sfunk View Post
So for some reason I cannot use the tool to save number variables, it won't give me the option, I got the string save to work just fine?

Never mind, I didn't realize that you had to manually type in the name of the number variable instead of being able to use the drop down menu like you can with a string.
Sorry if I didn't make that too clear. I'm not too sure what you mean by "being able to use the drop down menu like you can with a string", as you should still have to type in the name. It should only be a minor inconvenience though.


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 03-23-2012, 11:18 AM

Quote:
Originally Posted by arty-fishL View Post
Sorry if I didn't make that too clear. I'm not too sure what you mean by "being able to use the drop down menu like you can with a string", as you should still have to type in the name. It should only be a minor inconvenience though.
Well I used the save tool with a number variable and a string variable. The string variable was able to be located in the drop down menu under expressions (like using an if/else statement)

However, I tried the same procedure with a number variable, but it would not let me locate it under expressions, which I then just tried typing the variable's name in, which worked. I was just confused at first, but I now have it working.


If you are stuck on a project, check out the tutorials I made here at this link:

http://alice.org/community/showthread.php?p=36778#post36778

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..

http://www.youtube.com/user/sfunk1992?feature=mhsn
   
Reply With Quote
Old
KcajBR
Junior Member
 
Status: Offline
Posts: 2
Join Date: Feb 2012
Default 04-29-2012, 08:12 PM

Quote:
Originally Posted by arty-fishL View Post
Two answers.

The save data is stored in one file; location "Alice 2.2\Required\saveToolData" (it has no extension). That file is basically a stringified python structure and therefore loads and saves nicely with python.

The author string and game title string are both in place just to ensure each save variable gets a unique name and people who use the same game title don't overwrite each others saves. I may also give it other uses in the future, but for now its just an easy way to create unique save variable names.
How can I change the place where the save data is? instead of having it in Alice 2.2\Required\saveToolData have it in myWorldFolder\saveToolData

By the way nice job.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 04-30-2012, 11:46 AM

Quote:
Originally Posted by KcajBR View Post
How can I change the place where the save data is? instead of having it in Alice 2.2\Required\saveToolData have it in myWorldFolder\saveToolData

By the way nice job.
Thankyou. I would really like all of the save data in one file, as this tool replaces my old tool which had files scattered about all over the place. If you must change the save location, then try the attached model. It has a "save_filename" variable, just edit that (by default it will save to the "Alice 2.2\Required" directory if you do not enter a full path name).
Attached Files
File Type: a2c SaveTool.a2c (29.4 KB, 3 views)


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Old
KcajBR
Junior Member
 
Status: Offline
Posts: 2
Join Date: Feb 2012
Default 04-30-2012, 03:45 PM

Quote:
Originally Posted by arty-fishL View Post
Thankyou. I would really like all of the save data in one file, as this tool replaces my old tool which had files scattered about all over the place. If you must change the save location, then try the attached model. It has a "save_filename" variable, just edit that (by default it will save to the "Alice 2.2\Required" directory if you do not enter a full path name).
Thank You for answering so fast, and also for solving my problem, it works great. Thank You.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 04-30-2012, 08:57 PM

Quote:
Originally Posted by KcajBR View Post
Thank You for answering so fast, and also for solving my problem, it works great. Thank You.
you're welcome


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Reply

Tags
file, load, save, variable, write

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.