The Daily Click ::. Forums ::. Klik Coding Help ::. how would you go about saving and loading multiple strings of texts?
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
29th September, 2011 at 02:50:32 -

So i have it so when you pick up a gun it randomizes the prefix and the title. i want to know what would be the easiest way to save those so that i can hold up to 4 guns. i was thinking making an active object that stored the texts in its alterable strings, and when you select the according gun slot it would load those texts, i would also do the same in the alterable values for the damage and fire rate of the gun. would this work? i havnt bothered to try it yet because im wondering if anyone else has a better idea.

 
[Game design makes my brain feel like its gonna explode.]

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
29th September, 2011 at 04:24:40 -

Why does it randomize the prefix and the title? Do you mean when you pick up a gun object, it randomly picks out of 4 guns to give you?

Your method for loading text will work fine. MMF is so versatile. There are so many ways to do anything. I say just go for it and if it doesn't work, usually its pretty easy to see why and you learn something. I swear everyday I realise something about MMF I didn't know the day before. OMGGGGGGGGGGGGG CLICKTEAM I LOVE YOU!!!!!!

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
29th September, 2011 at 07:16:54 -

the game has a random gun generator. theres approximately 30 or so Prefix's a gun can have, and about 10 for each of the 8 different weapon classes, this randomization makes it easy to make many different guns, with differing stats, and differing elemental damage, firerate etc. (pretty much borderlands but sidescroller ) guess i should have given a better description

 
[Game design makes my brain feel like its gonna explode.]

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
29th September, 2011 at 16:18:02 -

Just save a string in some proper place(perhaps the player's alterable ones?) as;

str$(Prefix("generator"))+" "+str$(Name("generator"))+" "+str$(Suffix("generator"))

Note the space between the "". Prefix, Name and Suffix are those strings found in the generator.
Actually, if they are already strings I don't believe you need the str$().

Anyway that would save a string as; "Prefix Name Suffix", or "Mystic Detonator of Firearch"!

Something like that.

Save the values in an appropriate place. You really could save everything in a single array by converting between numerical values and strings or vice versa.

//EE

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
29th September, 2011 at 20:19:36 -

that all make sense up until the array thing. ive never done anything with an array, and i have very minimal experience with Ini files. any good articles i could read?

 
[Game design makes my brain feel like its gonna explode.]

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
30th September, 2011 at 03:17:23 -


In my current project (coincidentally also about Zombies haha) the player can pick up many different items. Each item has a name and a description stored as a string in an array and called upon when necessary. I made a separate program for editing these strings. The program saves the item list as a file called Items.arr which is then read by my game during runtime.

I'm not sure if it will be helpful but here's the link: http://www.create-games.com/download.asp?id=8530 It doesn't show how to pull the strings from the array in your game though. Maybe that is an example worth me making.

This one is a bit different http://www.create-games.com/download.asp?id=8528. It shows how to populate a list from an array.

I didn't understand Arrays either and would always opt for a ridiculous alternative like the List Object. Until a few weeks ago I started messing around with them. Testing all the conditions an actions. It was pretty confusing at first but I'm so glad I did.

 
n/a

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
30th September, 2011 at 17:30:00 -


Originally Posted by siven
that all make sense up until the array thing. ive never done anything with an array, and i have very minimal experience with Ini files. any good articles i could read?



Array or ini, both are great for the task. The minimal pros of the array is that it's encrypted automatically while you have to encrypt an ini *manually*, also, I believe the array to be the easier method in this case.

So what's an array?

Basically, it's a grid structured information file.
Think of it as an Excel spreadsheet, you've got a bunch of small pockets for storing numbers or text and retrieving them at a later point.

The array has three main parameters; X dimension, Y dimension and Z dimension.

Their different sizes make up the *shape* of your array.

Example;

An array of the dimension X 10, Y 1 and Z 1 would in reality be a row of 10 small memory boxes.

The X is how many columns to have in the array.
The Y is how many rows.

The Z is kind of special, it's the depth of the array. Like if you put a bunch of Excel sheets in a stack, you'd get a number of sheets, a Z value. So Z 1 means just one sheet of the specified X and Y dimension.

To illustrate this in ASCII art;

The example array of X 10, Y 1, Z 1 would look something like this.

OOOOOOOOOO

(imagine the O's are really boxes)

An array of the dimension X 7, Y 13, Z 1 would thus be:

OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO


And every little one of those boxes can hold a separate piece of information. Imagine the possibilities!

In your case, an array of the dimension X 3, Y 4, Z 1 could hold your weapon names!

OOO
OOO
OOO
OOO

or

[prefix][title][suffix]
[prefix][title][suffix]
[prefix][title][suffix]
[prefix][title][suffix]


What's great about arrays is that each individual box can be accessed by it's position in *the grid*.
The box(or cell) at X 1, Y 3, Z 1 would be [prefix] on line three.
X 3, Y 1, Z 1 would be [suffix] on the first line.

So in your case you could save the generator info to the appropriate cell on the appropriate line, and when displaying info about the weapon in question bundle a string with the X1+X2+X3 of the appropriate Y.

There's a bunch more to say about arrays, especially about 1 or 0 based indexes(basically, start counting from 0 or 1? A total dimension of 10 would be 0-9 in 0 based and 1-10 in 1 based).

Though I have to run to the store right now!

Search the articles, read the MMF2 manual or browse the clickteam site, thereäs information abundant!

//EE

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
30th September, 2011 at 19:23:22 -

thanks a ton guys! ill have to check out those chris
great explanation eternal man, i had a feeling it was something like that but the x y z thing threw me off and i was just confused. i think an arraw will work very well for what i need. thanks guys

 
[Game design makes my brain feel like its gonna explode.]

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
30th September, 2011 at 23:03:16 -

I would personally use an ini since it's compatible with all of the runtimes.

If you someday decide to "port" the game to iOS or something it'll be an easy conversion.
Also I wouldn't worry about encrypting stuff unless it's an online game, and honestly leaving things unencrypted adds more fun for the players since if they figure out they can change the values they can feel like 1337 hackers.

Plus it's just a cool easter egg, and easier to debug if necessary.

Edited by UrbanMonk

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
1st October, 2011 at 05:58:20 -

the iOS runtime doesnt support arrays? cuz i do eventually plan to port it *hopefully* to all the platforms possible.

 
[Game design makes my brain feel like its gonna explode.]

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
1st October, 2011 at 06:49:53 -

Whatever you do, don't use alterable strings in an active object as some have suggested. You can only have 10 alt strings per object.

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
2nd October, 2011 at 07:03:01 -

well that would be ok because i only need 8, 4 prefix's and 4 title's to be stored. those will be ONLY for the currently equipped weapons, the rest of them will be stored in an ini or an array, whichever i decide to figure out lol. thanks for the input though, ill keep that in mind

 
[Game design makes my brain feel like its gonna explode.]

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
2nd October, 2011 at 20:32:42 -

@Siven
Not sure if you still need help with this but I just made a new Array based inventory example which might be helpful.
http://www.create-games.com/download.asp?id=8549

@UrbanMonk
I'm yet to use the IOS exporter but according to this http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=240240, the array object IS supported.

@GamesterXIII
You may only have 10 alterable strings per active object, but how many active objects do you have? Usually quite a lot. What do you use instead?

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
2nd October, 2011 at 23:42:53 -


Originally Posted by Chris Burrows
@Siven
Not sure if you still need help with this but I just made a new Array based inventory example which might be helpful.
http://www.create-games.com/download.asp?id=8549

@UrbanMonk
I'm yet to use the IOS exporter but according to this http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=240240, the array object IS supported.

@GamesterXIII
You may only have 10 alterable strings per active object, but how many active objects do you have? Usually quite a lot. What do you use instead?



I started out using active objects, but if you want a flexible system you can't have 345345345 actives housing strings. I didn't know about the 10 string limit myself until recently.

The array system sounds the best as you and others have mentioned, though I'm not well-versed in arrays at all. If you want an alternative, multiple list objects technically could get the job done.

Edited by GamesterXIII

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
3rd October, 2011 at 03:04:57 -

True......... but the statement "WHATEVER YOU DO!!! don't use alterable strings in an active object" is a bit extreme. There are times for arrays and times for alterable strings.

Say you have multiple instances of the same object, a door for example.

It has 4 separate states: "open", "opening", "closed" and "closing".

If you have multiple doors, having the object state stored inside its "self" using in Alterable String is definitely better than using an array.

To use an array, you would need to spread a unique object ID over all Door objects and then test the match the ID for the current door to a door in the array. Way too complicated for such a simple task.

Alterable Strings (aka ULTIMATE STRINGS) until the day I FUCKING die!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click