The Daily Click ::. Forums ::. Klik Coding Help ::. [MMF2 dev R248] Random numbers, groups, Vitalize! etc
 

Post Reply  Post Oekaki 
 

Posted By Message

EleXor



Registered
  21/01/2003
Points
  269
15th May, 2009 at 14:22:25 -

Hello

I've been using MMF2 dev for a while now.

I've noticed the setting for random number generator which is -1 by default.
What does this mean? If I do random(10) is the result 0-9?
I'm doing a grid based (32x32) maze thingie and I want to set the player to a random position at the start, so I'm doing it like this:
+start of frame
-set player x to random(frame width)/32*32
-set player y to random(frame height)/32*32
With random number generator being -1, does this mean I could get strange (non grid) positions, like 319x63? Or is it rounded to grid system?

I got groups for generating the maze and adding stuffs like ladders and treasure.
The groups are like this:
1. Init
2. Map generating
3. Adding stuffs like ladders and treasure
4. Enabling player control

The map generating group might take a while so I've decided to make a custom progress bar, like a counter which is 0 by default and gets +1 when a group has done its actions. However, events like "Check for group activation" or "On group activation" don't seem to work. How do they work?

Yesterday, I uploaded my app with Vitalize! to my ftp server and it worked fine. Now it doesn't work at all, what happened? I haven't changed anything.

Last question:
I'm using MMF2 dev R248 like I mentioned earlier. If I publish a product, and decide to sell it or put some ads to it, how much am I allowed to do? I'm pretty sure this was mentioned somewhere on ClickTeam's site but I couldn't find it.

That's all for now, thanks .

--Edit: This is what ClickTeam's site says about MMF2 dev:
"Royalty free, logo and credit free - (no commercial runtime agreement required)"

Edited by EleXor

 
n/a

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
15th May, 2009 at 14:33:29 -


Originally Posted by EleXor
Hello
What does this mean? If I do random(10) is the result 0-9?


Hello

And yes. If you have
random(10)+1
it would pick the numbers 1-10.


Last question:
I'm using MMF2 dev R248 like I mentioned earlier. If I publish a product, and decide to sell it or put some ads to it, how much am I allowed to do? I'm pretty sure this was mentioned somewhere on ClickTeam's site but I couldn't find it.

That's all for now, thanks .

--Edit: This is what ClickTeam's site says about MMF2 dev:
"Royalty free, logo and credit free - (no commercial runtime agreement required)"



With MMF2 Dev you're allowed to sell it, you're allowed to make money from adverts within it, you're allowed to take it on a caravaning holiday to Scarborough if you really wanted.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
15th May, 2009 at 14:40:19 -

Random Numbers in computers are most often based on a random 'seed' as truly random numbers can't actually be generated (simply). The -1 just means that MMF uses a different set of numbers each time. For example if you set it to 10, this means that MMF will use number set "10" every time on the application. Your random numbers won't be 'random' and they will be predictable. If you use the code: start of frame set counter to random(5), it will set the counter to the same number every time.

I'm not sure how this changes the answers to your other questions, but if you use random(10) MMF will choose a random number from 0-9 as it uses a starting point of 0.

The code you have given will always give a grid position, try it for yourself and see that it works!

Check for group activation work as you would expect them too you simply put them in as a condition and have an action that you want. Maybe you could share your code with us in a simpler example and we could look at it?

I don't have any idea about your vitalize app. It could either be the server or maybe your browser wasn't working correctly and is blocking/not running the application properly.

In terms of publishing, The Developer version of MMF2 is restriction-free! You can release and sell any game/program you make in MMF2Dev and you don't have to include any other information or credits. That is the main advantage of the Developer edition.

I hope this helped.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

EleXor



Registered
  21/01/2003
Points
  269
15th May, 2009 at 15:18:01 -

Thanks guys for the quick responses !

My groups work like this (too lazy to upload anything at the moment!):
Group 1:
+do stuff
+enable group 2
+disable group 1

Group 2:
+do stuff
+enable group 3
+disable group 2

So the whole idea is to disable everything until we get to the "player controls" group which has all the movements and stuff. This group is never disabled.
If I do events like:
-Group 1 enabled -> add 1 to progress
-Group 2 enabled -> add 1 to progress
It won't work. Even if I do something silly as "If a group has been enabled, close the app".
I know a solution how to make a custom progress bar, but I definitely want to use those group events which are build-in.

About my Vitalize! dilemma:
I recall uploading my app to my ftp server. Everything worked fine for hours. Then I decided to make some changes to the .ccn file and I uploaded it, it won't work. It doesn't work even locally. All I get is the Vitalize! logo . I tried to rebuild the app without the changes and rebuild the code for Vitalize!. No help at all.

I've got a new question. I've got a working solution to place the ladder (which takes you to the next lvl) in my maze, but it's way too slow. I'm using Pathfinding Object to build the maze.

So I want to place the ladder in to a position which is reachable from one way only. My maze thingie is 4-dir. The whole point is to get the ladder to a random "corner" place, so it won't be in a middle of a way.
Here's some ASCII to explain it better:

W = Wall
L = Ladder
O = Floor / opening, actually, let's say "not an obstacle".

WWW -- Case 1
WLO -- The ladder is reachable from right side only.
WWW

WWW -- Case 2
WLW -- The ladder is reachable from down side only.
WOW

WWW -- Case 3
OLW -- The ladder is reachable from left side only.
WWW

WOW -- Case 4
WLW -- The ladder is reachable from up side only.
WWW

Alright, those are the positions I want the ladder to be placed at.
Here's my code (roughly):

+On loop (place_ladder)
-Set ladder x to (Random(frame width-32 PLUS 32) PLUS 32 /32 * 32
-Set ladder y to (Random(frame width- 32 PLUS 32)PLUS 32 /32 * 32

Those -32 and PLUS 32 are fixes so the ladder won't be placed inside a wall, since the actually play area starts from 32,32. Hard to explain without screenshots.

And here's the code to check if the ladder is positioned correctly, and if the loop should be stopped.

I'm only writing it for case1 here, but I got every case included in my game.
+Ladder isn't overlapping an obstacle
+Ladder x PLUS 32 & Ladder y is not an obstacle
+Ladder x PLUS 32 & Ladder y PLUS 32 is an obstacle
+Ladder x & Ladder y PLUS 32 is an obstacle
+Ladder x-32 & Ladder y PLUS 32 is an obstacle
+Ladder x-32 & Ladder y is an obstacle
+Ladder x-32 & Ladder y-32 is an obstacle
+Ladder x & Ladder y-32 is an obstacle
+Ladder x PLUS 32 & Ladder y-32 is an obstacle
-Stop loop

The above solution works, but it might take a while for the ladder to be set, since it's random. If anyone can think of a better solution, fill me in .

PS: Why does TDC filter my plus characters? It's really hard to explain the code without them .

Here's a pic of the game: Image
That's how the ladders should be placed, but my method for placing them is way too slow. That game is actually 16x16 rather than 32x32, but you should get my point.

Code:
Image
Image
Image

Again, a new question: Is it possible to save and apply the default application settings to a new application? I hate it when I have to remove the menu manually and the setting to make the app 256 colours.












Edited by EleXor

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
18th May, 2009 at 18:53:46 -

Alright, my main concern is now the fact that Vitalize! refuses to work. I can't get it work on web nor offline. I tried building new apps and code for it and it still won't work. Not even on different computers, or browsers, or with the combination of all those. I reinstalled the Vitalize! plugin several times and it didn't help either. Anybody knows what's going on?

edit: It appears I was using a faulty Vitalize! code generator. Strangely, though, it worked for the first time. I build the code myself by reading some forums and got it to work.

Edited by EleXor

 
n/a

bigredron



Registered
  07/04/2007
Points
  299
19th May, 2009 at 03:41:16 -

Assault Andy: You are wrong. The number in the bracket is not the seed from which the numbers are picked. I dont know what MMF2 uses for a seed (maybe os.time?) but random(5) would pick a number from 0-4 and will NOT be the same everytime.

To answer the OP question. MMf2 is always 0 based, so to get a number between 1-10 you would need to do random(10)+1

 
n/a
   

Post Reply



 



Advertisement

Worth A Click