Author Topic: Help with while loop  (Read 13069 times)

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Help with while loop
« on: February 02, 2011, 02:19:02 AM »
I started making maps in Eufloria some days ago, but can't make more because of this simple error: My while loop won't start, but all the other stuff works fine, help???

FIXED!
« Last Edit: February 02, 2011, 03:02:31 AM by Aino »

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Help with while loop
« Reply #1 on: February 02, 2011, 02:25:06 AM »
I don't think that there is any problem with the while loop. Can you post your whole level? It might be something in the rest of it causing a problem.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #2 on: February 02, 2011, 02:29:50 AM »
Yep, your code looks fine to me.  :>  It should work.


As Pilchard says, if you can post the rest of the code that would be great.  If you don't want to make it public, just PM it to one of us.  :>

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #3 on: February 02, 2011, 02:31:57 AM »
Just posted it... Hope you can help, else this will ruin my day xD

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #4 on: February 02, 2011, 02:37:15 AM »
Forgot something on the top og the LevelLogic function, hope it isn't the fault ...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #5 on: February 02, 2011, 02:37:35 AM »
Ok check back in 5 mins :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #6 on: February 02, 2011, 02:38:28 AM »
Bloddy hell, this is advanced for a first map!

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #7 on: February 02, 2011, 02:41:15 AM »
Bloddy hell, this is advanced for a first map!
Thanks? Better thanks Alex and you for that... taking some examples :)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #8 on: February 02, 2011, 02:41:41 AM »
Found the problem in the console.  (press tilde ingame)  It relates to the way you're declaring the AI stuff.

Just uploading screenshot..





Will play around with it now and see if I can get it working.  :>

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #9 on: February 02, 2011, 02:47:19 AM »
Found the problem in the console.  (press tilde ingame)  It relates to the way you're declaring the AI stuff.

Just uploading screenshot..

image*

Will play around with it now and see if I can get it working.  :>
Ohh, did never check the console... I am used to get error before starting the map... Thanks for the help there though :)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #10 on: February 02, 2011, 02:47:56 AM »
Aha!!

Think I got it.

Ok, currently you've formatted your AI commands like this:


Code: [Select]
GetEmpire(2):ExpandBlind(0)
Like it was a function.  But, the AI's attributes are actually a property of the AI.  So it should be formatted like this:


Code: [Select]
GetEmpire(2).ExpandBlind = 0edit - corrected typo in code above

Haven't tested i with all of them, but that is definitely what is going on, I think.
« Last Edit: February 02, 2011, 02:52:40 AM by annikk.exe »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #11 on: February 02, 2011, 02:49:46 AM »
Ohh, did never check the console... I am used to get error before starting the map... Thanks for the help there though :)


Man, I should really make a "troubleshooting your maps" guide, outlining basic stuff like that.  Or mention it in the beginner's guide or something.  It's these small things we take for granted and forget to tell the new people about!

Hope you get this working now dude.  Let us know how you get on.  :>  Feel free to edit your initial post to remove the code if you don't want others to see the level before it's done.  :>

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #12 on: February 02, 2011, 03:03:15 AM »
Thanks annikk, but one thing... isn't the while supposed to loop forever?

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Help with while loop
« Reply #13 on: February 02, 2011, 03:06:13 AM »
Code: [Select]
AI function/attribute stuff



Why didn't I see that?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #14 on: February 02, 2011, 03:30:56 AM »
Thanks annikk, but one thing... isn't the while supposed to loop forever?

Yep, it should do.  Why, what behaviour are you seeing?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #15 on: February 02, 2011, 03:39:45 AM »
Thanks annikk, but one thing... isn't the while supposed to loop forever?

Yep, it should do.  Why, what behaviour are you seeing?
This, of course only testing:
Code: [Select]
r=0
b=0
g=0
r=r+1
b=b+1
g=g+1
SetBackdropColor(r,g,b)
(it just stays black all the time)

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Help with while loop
« Reply #16 on: February 02, 2011, 03:46:22 AM »
Every loop of the while loop, r,g,b is set to 0,0,0 since you have the lines

r=0
g=0
b=0

Move them outside the loop and it will work.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #17 on: February 02, 2011, 03:46:49 AM »
Lets take r as the example here.
On the first run of the loop, r is set to 0.  Then it is set to 0 + 1, which is 1.
Then the backdrop colour is set to (1,1,1)

On the second run of the loop, r is set to 0 again, then 0+1, and the backdrop colour stays at (1,1,1).


To fix, move r=0, b=0 and g=0 above your While loop.  :>  Then they will be run once, but not again.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #18 on: February 02, 2011, 03:47:16 AM »
Damnit pilchard, TWENTY FIVE SECONDS faster, zomg :p

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #19 on: February 02, 2011, 03:48:51 AM »
God! I am so stupid, thx again guys :D

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Help with while loop
« Reply #20 on: February 02, 2011, 03:52:09 AM »
No worries dude, and don't worry, we ALL make mistakes like this ALL the time.  :>

I once spent more than an hour trying to fix a bug in my level.  I thought I'd got it straight away, but the bug was still there.  I pored over the code for at least an hour before realising I was looking at the wrong file!

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Help with while loop
« Reply #21 on: February 02, 2011, 03:53:15 AM »
Read my picpost. You're not the only one who makes dopey mistakes.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Help with while loop
« Reply #22 on: February 02, 2011, 04:06:18 AM »
Now as that barrier is away, I can finally begin my coding :D