Custom Save/Load System (lots of scripting)

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

Postby Imari » Fri Jun 05, 2009 3:22 pm

Yes, don't blame Lyberodggy for the thumbnail system. I added the thumbnails system. Everything that Lyberodggy made actually worked. :P
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Postby mercedes » Fri Jun 05, 2009 6:19 pm

Another thing u may, or may not want to try;
This is an interface I had in mind~ It would consist of only 2 Frames--Main Frame and Thumbnail Frame~

When exiting the game, the user would be taken to the MAIN frame-There would have to be an EXIT on each frame or MAIN MENU. Only 1, where you could save-data/inventory ect--on Exit

The Main frame where you see;

LOAD--Would take u to thumbnail frame where user can choose the latest thumbnail/frame.--Up pops a box--one you draw.
On it;
Do you wish to Load the game? Cancel and OK--All actions go here.
Therefore each thumbnail would only load that frame--

SAVE--Only here could the user save his game. He would physically have to press this..A box would come up--One that is drawn--
On it;
Do u wish to save? OK--From this point when they left the frame they left hitting EXIT--it would save it here too.
Also, when they hit OK, it could take them back to MainFrame to Exit--or the Thumbnail frame, so it would recall just that frame--in the OK button. It would have an EXIT button on this frame too..

The thumbnail would have to be saved as well, therefore its present when they start game again.
All other thumbnails would be invisible.

RESUME--This would only be used for going back to the last visited, in other words, only with a PAUSE button on each frame.

EXIT--This would physically exit the game--No option to LOAD nor SAVE.

I hope this makes sense..:?

In my mind it sounded a bit simpler..yet i think it could be effective..I must have said thumbnail 700 times..and i'm not sure, but i feel like I'm forgetting something..
What do u guys think...?

Keeping in mind, I'm not totally sure, what all transpired.. in this thread..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby juhuwoorps » Fri Jun 05, 2009 7:39 pm

if you have a custom inventory, it would be easy to create a save-point.
you just have to save the variables. this could be a save to resume, as Mercedes said.
but save points?...
it would be nice if reneuend could post a tutorial how to use ini-files!
perhaps we find together an easy way to built a custom save/load system :)
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Sat Jun 06, 2009 2:31 am

I'm offsite, but when I get back home on Monday, I'll explain how it works...if Lyberodoggy doesn't beat me to it!
---


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

Postby Lyberodoggy » Sat Jun 06, 2009 9:49 am

Ok, here it goes :P
You have mainly two commands:

Action.WriteINI(filename,index,row,text_to_write)
Action.ReadINI(filename,index,row)

From here, there's a new concept of the technique that is used in the first page of this post
So, all you have to do is create a procedure that saves everything you need to load a game into this INI.

So, first of all you save the frame
instead of picking up an index for the frame, we 'll pick up an index for our saved game. Let's say it's saved game no.1, the index will be 1
in the first row let's store the frame

Code: Select all
Action.WriteINI "savedgames.ini",savedgameindex,1,frametosave

Now for the items (default inventory):
Code: Select all
For Each X in InventoryItemObject
I=I+1
ItemArray(I)=X.tag
Next
Action.WriteINI "savedgames.ini",savedgameindex,2,I
For counter=1 to I
Action.WriteINI "savedgames.ini",savedgameindex,counter+2,ItemArray(counter)
next

And finally for vars:
Code: Select all
Action.WriteINI "savedgames.ini",savedgameindex,counter+3,WindowObject.Variables.Count
For i = 1 To WindowObject.Variables.Count
Action.WriteINI "savedgames.ini",savedgameindex,counter+3+i,WindowObject.Variables.Item(i).Name+" "+cstr(WindowObject.Variables.Item(i).Value)
Next
Action.WriteINI "savedgames.ini",savedgameindex,counter+4+WindowObject.Variables.Count,WindowObject.VariablesVariant.Count
For i = 1 To WindowObject.VariablesVariant.Count
Action.WriteINI "savedgames.ini",savedgameindex,counter+4+WindowObject.Variables.Count+i,WindowObject.VariablesVariant.Item(i).Name+" "+WindowObject.VariablesVariant.Item(i).Value
Next


Well that's for saving. The loading code is easily figured out. For items, variables and variants you first read how many of them exist, then create a for loop to retrieve them
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby reneuend » Tue Jun 09, 2009 10:48 pm

(UPDATE)
I just wanted yall to know that I haven't given up on this. Actually, I'm almost finished with the first draft. I just have ONE issue to iron out and seems simple, but I can't find the problem: The Integer variables aren't getting populated on the Load option. :?

Image
I built this so you can have unlimited Saved Games.

To Do:
-Add Game Deletion
-Add inputbox for Caption (optional)
-Allow option for Auto-Saves
(would be a plugin option on the frame properties)
---


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

Postby reneuend » Wed Jun 10, 2009 5:07 am

I can't find the issue with the ReadINI and the integers. I've loaded my project code, plugin file, and OCX file in one ZIP file.

The subroutine to look at is in the plugin: AM_LoadGameHotspot()

A sample INI file looks like this:
[INT]
1=s;6
2=n;8
3=b;4
4=gamecount;4
5=AMSLG_LoadGameIdx;0
6=AMSLG_PageNum;1
[STR]
1=AMSLG_GameFileList;0
[INV]
2=shovel
3=book
4=note
[FRM]
1=Page 1
[CAP]
1=The Forest
[TMB]
1=forest.jpg


Thanks for anyone willing to look a this! :)
Attachments
Load - Save Test.zip
(268.48 KiB) Downloaded 901 times
---


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

Postby Lyberodoggy » Wed Jun 10, 2009 9:28 am

Lyberodoggy wrote:To load integer variables from the string variables that are delimited in the INI you need to use ConvertToNumber


I saw you had it... well your mistake is this: You didn't split the text with the delimeter inside the INI.

Code: Select all
    For i = 1 To WindowObject.Variables.Count
      IntArray=Split(Action.ReadINI(filex,"INT",i),";")
      WindowObject.Variables.Item(i).Value= ConvertToNumber(IntArray(1))
      MsgBox "Int = " & WindowObject.Variables.Item(i).Value   
    Next



I 'd also strongly recommend that you removed the gamecount variable and stored it only in an INI because, each time a game is loaded, if it's not the newest one it's gonna cause the game to see less saved games (because of the stored gamecount var being lower in older files)
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby reneuend » Wed Jun 10, 2009 1:06 pm

Thanks Lyberodoggy! :)

The gamecount is just the number of savedgame files. Along with several other vars, this doesn't need to be in the INI at all, so when I get this working, I'm going to exclude it.

(edit) It's working!!! Lyberodoggy saved me again! 8)

:?: Who is willing to do some testing for me?

Once I clean up the code and it passes testing, then I will add the other planned features.
---


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

Postby juhuwoorps » Wed Jun 10, 2009 3:53 pm

I'm willed to test it for you!
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Wed Jun 10, 2009 4:12 pm

Thanks juhuwoorps! :)

I'm finishing up the code now and will PM you with a link to the package when I have it finished.

If anyone else is interested in testing, just let me know!
---


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

Postby Imari » Fri Jun 12, 2009 2:32 pm

So many improvments to AM all at once! Whoo-hoo!!

I'd love to test it, reneuend, but I can't do it until after this weekend, sorry.
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Postby ShadowHunter » Fri Jun 12, 2009 3:01 pm

Hi Reneuned,

Sign me up... I'm looking forward to try it :wink:

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby reneuend » Fri Jun 12, 2009 4:16 pm

I'm probably going to release the first version of this plugin soon. I have all the fixes finished from 2 of 3 testers that have responded. The only thing that I really lack is a good demo to go with the plugin. I'll try to release it in the next few days.

The 'Breath' project is starting to pick up, so I need to redirect my time to them. Also, I have my 'Shayne' project to get back too! And a few other promises I've made to people. :)

(edit) I wrote up a script for a demo this evening. I'll spend this week building a small demo and get this plugin released at the end of the month...because I know yall are dying to use it! :)

(edit) I've been working really hard on the demo for this. It's taking me so long because I am playing with Anim Studio Debut 6. I think it's going to be a pretty funny demo....at least that's what I'm aiming for. Give me another week or 2! Pleeeeease!

This is WAY overdue! :shock:
My new contract has really taken up my free time. My solution with this is to do to be more realistic with what I had planned for the demo, reduce the amount of complexity, and just get it done. I had an animated cursor that stopped working when I returned to work on it. Instead of trying to figure it out, I'm going to pull it (I get an error that says the files are missing, when I reality they are there).

Good news. I fixed the animated cursor issue. There are some KeyGuard 4 commands that require the "GetPath" call and others that don't. I got a lot done on the demo today, but there are a lot of animations in this.
---


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

Where can I get the project or code

Postby gposchman » Mon Jan 04, 2010 10:17 pm

I am new to AM and I would prefer to use a custom save and load for my game. I followed the thread and I was wondering if there is a project I can download or is there a place I can find the tutorial completed?

Thanks in advance.


Gene
If it looks like a duck, walks like a duck and quacks, It is probably a decoy.

Shoot it anyway!

Gene
User avatar
gposchman
Member
 
Posts: 18
Joined: Tue Dec 29, 2009 1:29 am
Location: castro valley, Ca. USA

Postby reneuend » Tue Jan 05, 2010 3:20 am

Hi g'man,

I finished the plugin and have been in the process of building a game that shows how to use it. As a contract developer who travels several hours a day, I don't always have much time to work on my projects. :?

I'll try to finish it in the next 30 days, unless you'd like an early unfinished edition!

There is also one suggested enhancement from Lyberodoggy that I would like to add.

Thanks for your interest.
---


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

Postby Vairon » Tue Jan 05, 2010 9:20 am

Reneuend is great news! :D
It is a breakthrough for the development games on AM and I think you're doing a great job.
I am eager to see the results.
User avatar
Vairon
Forum Master
 
Posts: 500
Joined: Sat Jul 14, 2007 12:40 pm
Location: Spain

Custom load box

Postby gposchman » Tue Jan 05, 2010 6:40 pm

Hi reneuend,

I am actually in development on my game (Currently unemployed) and I am working on a custom opening page and I am ready to implement, so if you have an unfinished edition of the plugin plus notes on the enhancement and what needs to be done, I would be happy to take it on and I will publish the game I am working on with a level completed and documentation so people will know how to use it.

Gene
If it looks like a duck, walks like a duck and quacks, It is probably a decoy.

Shoot it anyway!

Gene
User avatar
gposchman
Member
 
Posts: 18
Joined: Tue Dec 29, 2009 1:29 am
Location: castro valley, Ca. USA

Postby reneuend » Wed Jan 06, 2010 12:38 am

Thanks for the support Vairon and Gman.

Give me a little time to build the documentation. I'll post an early release for everyone.

If when using it, you have any suggestions on improvements, please let me know.

I'm not completely satisfied with it, but I'm not sure what the best way is to present it so its easy to use and still versatile. I'm thinking maybe I should build more subroutines that folks can use to allow more customization.
---


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

Postby JasonMc » Thu Aug 19, 2010 7:28 pm

Ok, good news, bad news.

Good news is, I made it possible for there to be a list of saved games on the save screen!

The bad news is...I cannot figure out for the life of me what is wrong with the load. I started using Lybero's updated variables saving code (from towards the bottom of page one). However, I know there has to be SOME way to load that, other than what was there. The indexes changed, after all.

Anyhow, here is my save code, which appears to be working perfectly. I have this plugged into my global procedures, as I use it for autosaving.


Code: Select all
Sub AGENTSAVE()
frametosave=Action.GetCurrentFrameName
If frametosave="menu" Then frametosave="1.1.1"
I=0
For Each X in InventoryItemObject
I=I+1
A=X.tag
Action.WriteINI filename+".agent",1,I,A
Next
For i = 1 To WindowObject.Variables.Count
Action.WriteINI filename+".agent",2,i,WindowObject.Variables.Item(i).Name
Action.WriteINI filename+".agent",3,i,WindowObject.Variables.Item(i).Value
Next
For i = 1 To WindowObject.VariablesVariant.Count
Action.WriteINI filename+".agent",4,i,WindowObject.VariablesVariant.Item(i).Name
Action.WriteINI filename+".agent",5,i,WindowObject.VariablesVariant.Item(i).Value
Next
Action.WriteINI filename+".agent",6,i,frametosave
End Sub


Here is the load button procedure. What is wrong with it?

Code: Select all
filenamefull=FileBoxObject(2).FileName
For I=2 to 50
savedinventoryitem=Action.ReadINI(filenamefull,1,I)
If HasItem(cstr(savedinventoryitem))=False Then
Action.AddItem cstr(savedinventoryitem)
End If
Next
For C=1 to 50
Action.ReadINI(filenamefull,3,C)=Action.ReadINI(filenamefull,2,C)
Action.ReadINI(filenamefull,5,C)=Action.ReadINI(filenamefull,4,C)
Next
UnloadControl FileBoxObject(2)
UnloadControl TextBoxObject(3)
Action.GoToFrame Action.ReadINI(filenamefull,6,1)


Additionally, if anyone knows how to delete an INI file from that file list in VBScript, that would be cool. If not, no prob.
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby Lyberodoggy » Mon Aug 23, 2010 2:14 am

The only thing I suspect to be wrong is this: the readINI command looks for the file inside the external folder. it's 4:14 am here so I can't really look into it right now, but I 'll try to figure it out
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby JasonMc » Mon Aug 23, 2010 5:56 am

That's where I parked the .agent files, so that shouldn't be an issue. Although I've been having this odd little glitch where the filebox tends to go to whatever path I last navigated to on the "Add New Frames..." dialog...how weird is that? Anyhow, it listed the files right, so I don't suspect that it has the wrong path.

One thing I did think of just now is, could the problem be that I call .path and NOT .filename?

Anyway, I have a webmastering job atm, so I can't exactly explore it either right now. Anyone who can take a look any time soon, you would have my gratitude. :)
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby Lyberodoggy » Mon Aug 23, 2010 10:40 pm

You could try reading from Getpath(4)+filenamefull
If I remember correctly 4 is the external folder.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby reneuend » Sat Jan 08, 2011 9:15 pm

Has it really been 2 years! :oops:

I have this plugin working in Windows 7 now. It was very hard to read my code. I hope to have something available soon.
---


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

Postby Mystery » Sun Jan 09, 2011 12:28 am

Hehe, time flies fast :P

Great news that you'll have something available soon :D
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sun Jan 09, 2011 10:43 pm

:O two years huh?
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sun Jan 09, 2011 10:44 pm

Lol :lol:
Nice to see you Doggy :D
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sun Jan 09, 2011 10:53 pm

:) nice to see you guys too.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby reneuend » Sun Jan 09, 2011 11:13 pm

Yeah :oops:

I don't know how time slipped by like this, but I guess it just does.

Great to hear from you again Doggy!
---


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

Postby Adpist » Thu May 19, 2011 11:49 am

Hi there !

First of all, thanks for this thread =)

I manage to create custom save and load functions using parts of your scripts, And i have found an issue, and i really don't know how to fix it.

I save all items in inventory when user click save button.
When i load them, i can add items to player's inventory, everything is fine with this part. The problem is that if i save the game, take a new item in inventory, and load previous save ( before taking item ), I can't take the item anymore ( which is somekind of normal, i guess ).

So there is my question : Is it possible to have acces to the list of items present not only in inventory, but in all the differents frames ( or their hotspots ) to enable / disable item picking according to the saved game state

i see a way to do it but i need access to all game's items, or to be able to check if hotspot gives an item and disable it if item is in inventory.

I want to add that as if you have a welcome documentation, there are some parts missing in the AM's doc ( like how to access to hotspot position ? hide TextBoxObject borders ? etc... )

I post this here because my save/load functions are really similar to the ones mentionned in this thread.

Thans for your answers.

Colin
Adpist
Junior Member
 
Posts: 6
Joined: Thu Feb 10, 2011 11:56 am

PreviousNext

Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests