The Daily Click ::. Forums ::. Klik Coding Help ::. Newbie’s question how to pair user’s choices with external images & load external images?
 

Post Reply  Post Oekaki 
 

Posted By Message

dailysunny



Registered
  18/09/2014 10:31:45
Points
  3
18th September, 2014 at 18/09/2014 10:43:41 -

Im a newbie to MMF2, just messed around with MMF2 for 2 or 3 weeks, now I have been stuck here for a couple of days----for example, in 2nd and 3rd frames, among many buttons user clicked "fishing" button and "sleeping" button as their final choices, then I used Array to carry the data to the current frame(4th frame) where the "fishing" button and "sleeping" button will show up, now is it possible to load external images(i.e "fishing.gif" saved in pictures folder) automatically based on user's previous choices(i.e "fishing" button)?

Every time user's choices might be different, how can I ask MMF2 to pair these two (the button user clicked and the image in the picture folder), then either load images automatically OR trigger the action to jump to specified frame automatically?

Do I need to use ini files or something else?

What would be the best way to figure out this problem?

Sorry if this question seems to be a stupid one, and thanks for any help in advance!


 
n/a

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
18th September, 2014 at 18/09/2014 15:53:10 -

I like how You are using array's and loading external images. But I can i recommend to you to import your images into the game instead of loading them externally. Your counter objects can hold pictures to and its a easy way to display one picture. Just as long as their isn't to many fishing pictures, it shouldn't take to long to import them.

If their are to many fishing pictures. I then suggested loading them. Which will probably require you to learn more about strings. So you can add a couple together to generate the right command path for the images. A ini file is not needed for that inless you want to add a save game feature to the game.

 
https://www.facebook.com/nathon.brown.7

dailysunny



Registered
  18/09/2014 10:31:45
Points
  3
19th September, 2014 at 19/09/2014 12:06:02 -


Originally Posted by Pan-tosser
I like how You are using array's and loading external images. But I can i recommend to you to import your images into the game instead of loading them externally. Your counter objects can hold pictures to and its a easy way to display one picture. Just as long as their isn't to many fishing pictures, it shouldn't take to long to import them.

If their are to many fishing pictures. I then suggested loading them. Which will probably require you to learn more about strings. So you can add a couple together to generate the right command path for the images. A ini file is not needed for that inless you want to add a save game feature to the game.



Hi thank you "Pan-tosser"! I may try counter firstly to see how it goes, didn't know it can hold picture as well... otherwise I will study more abt strings...

 
n/a

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
19th September, 2014 at 19/09/2014 15:49:28 -

if you still end up stuck just ask for someone to post an example, and i'm sure you will get one. The click isn't like it use to be, but it is still a great resource.

 
https://www.facebook.com/nathon.brown.7

dailysunny



Registered
  18/09/2014 10:31:45
Points
  3
20th September, 2014 at 20/09/2014 12:52:53 -


Originally Posted by Pan-tosser
if you still end up stuck just ask for someone to post an example, and i'm sure you will get one. The click isn't like it use to be, but it is still a great resource.



Hi 'Pan-tosser', thanks again! I think the Click is a great place, I've got to learn a lot from those posts, and I do think MMF2 is a great game engine, but it seems to be a nice kit for designing game with more 'collisions' or so, I love to 'destroy' objects in MMF2, but if mine is a Sim game that probably won't be a really suitable choice? Anyway, I will try my best to give it a go....

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
22nd September, 2014 at 22/09/2014 14:02:15 -

Sim games are definitely possible in MMF2/CF2.5. MJK made Hotel Baron (http://www.create-games.com/download.asp?id=8635) using MMF2 so as I say it is definitely possible it just depends on your skills and the scope of the project.

A lot of members new and old suffer from Big Game-itis, the urge to create a large scale game and the eventual collapse of the game. I include myself in this.

Good luck and do ask for help on anything. If you find it difficult to put into words what you need then an example or pseudo code always helps us to help you.

 
n/a

The_Antisony

At least I'm not Circy

Registered
  01/07/2002
Points
  1341

VIP MemberStarSnow
24th September, 2014 at 24/09/2014 21:42:15 -

It's still possible to use external images and an array... plus working with external files is important to learn.
If you've got two frames, one with buttons - the other that shows images via an Active Picture object, then you can approach this a few possible ways.

You could continue passing strings to your array, but name your image files to the strings you're currently passing to the array. In other words, if when your player selects the option "fishing", then "fishing" passes to your array and fishing.gif is the name of the file you're trying to access.

On the next frame, you could use an Active Picture object to open an exteral file at the start of the frame. Use an expression instead of selecting the fishing image directly. In the expression, you can tell MMF to access the project directory (or the directory the exe is stored in once compiled) by using Apppath$.

Apppath$+ARRAY_STRING+".gif"
^^Access fishing.gif from the project directory.

Apppath$+"IMGS/"+ARRAY_STRING+".gif"
^^Would attempt to load fishing.gif from the project subdirectory /IMGS.

There's a way to do about the same thing using a single global string, string parser 2, and Active Picture.
When a user selects an option, set Global String A to Global String A+ARRAY_STRING+"|".
In an event on the next frame, at start of level define "|" as a delimeter in String Parser 2 and set it's source text to Global String A. You can determine the number of selected options by the number of elements stored in String Parser 2. A fastloop could create a number of Active Picture Objects and set them all to display individual pictured determined by previously selected user options.

 
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
25th September, 2014 at 25/09/2014 16:46:11 -

I think a lot of click users could up their game with strings. I load external files all the time and i still have never used Apppath$ or the string parser.

The use subdirectory's is something i always wanted to do. Just never could figure out how to do it. Cause of all the old string methods i've have been using.

I agree though, working with external files is a important thing to learn. It's a vary simple goal programmers can use in conjunction with strings.

 
https://www.facebook.com/nathon.brown.7
   

Post Reply



 



Advertisement

Worth A Click