Source language: Translate to:

Arranging Objects on the screen in a random fashion

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Arranging Objects on the screen in a random fashion

Postby Just4Fun » Sat Apr 17, 2010 9:52 pm

Hi Everyone:

I've been using Dave's example to randomly place objects on the screen. See thread: http://www.neosoftware.com/forum/viewto ... highlight=

My question relates to arranging objects around a larger object. I have 50 small objects and one large object in the center. As it stands now, I use 4 subroutines to call the random routines that setup 20 objects in two rows of 10 across the top of the screen. Then call two more routines for the left and right 10 objects that are in two columns around the object and then call a final routine for the 10 last objects across the bottom.

The screen looks like this with spaces between the center objects and those on the left and right.:

**********
**********
** XX **
** XX **
** XX **
** XX **
**********

Is there a way to do this so that all of the objects can be included and arranged in a random fashion around the center object? As it stands now, the code works works! :-)

However, the way I am doing it doesn't sort all of the objects at once and place them in correct spots around the center object. :(


I have tried without success to use the IF statement to work with the formula:

Code: Select all
If "sign[Num]" "<" "21"
...do the random arranging of objects across the top of screen
else

If "sign[Num]" ">" "21" AND < 31
...do the random arranging of objects on the left of screen
else

If "sign[Num]" ">" "31" AND < 50
...do the random arranging of objects on the right of screen
else

If "sign[Num]" "<" "50"
...do the random arranging of objects on the bottom of screen
endif


How should this problem be approached? Am I on the right track with the use of IF or should I use something else? Thank you for taking the time to help. I hope that I'm making myself clear.

Hope everyone is having a good weekend.
Thank you.
-Rachel
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA

Postby Wrangler » Sun Apr 18, 2010 9:15 am

Each If/Else needs an endif.

If something = something
do this
else
do this
endif

Don't know if this will solve your problem, but it's the correct syntax.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Ndzn » Mon Apr 19, 2010 5:55 am

Your sample code may have been just quickly hand-typed, but I also see where you're using...

If "sign[Num]" ">" "21" AND < 31

whereas, it should read something like...

IfEX "sign[Num] > 21 AND sign[Num] < 31"
User avatar
Ndzn
 
Posts: 134
Joined: Sun Sep 20, 2009 8:37 am

Postby Wrangler » Mon Apr 19, 2010 7:56 am

Good catch, Cpn. I missed that one.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests