Table variables into textboxes problem.

  • Tony_Vallad
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9

Post 3+ Months Ago

Hi everyone, well, here's my problem. I've got a two dimention table like that one:
Code: [ Select ]
for (f = 1; f < 8; f++) {
    for (ff = 1; ff < 8; ff++) {
        prix[ff][f] = 1
    }
}
  1. for (f = 1; f < 8; f++) {
  2.     for (ff = 1; ff < 8; ff++) {
  3.         prix[ff][f] = 1
  4.     }
  5. }

I want to desplay these variables (prix[0][1], prix[0][2], prix[0][3], ...) into textboxes without having to enter them in other variables like prix01, prix02...

I can't put a variable like prix[0][1] into a textbox by just telling the textbox that it's variable equals to these.

Is there any way to get the variables into the texboxes without writing them all by hand (by doing a loop)?

If not, is there any way to do a loop without the [] symbols?

Thanks.

PS. An other problem is this line:
Code: [ Select ]
if (prix[ff][f] == int(0,9 * max[f]) and prix[ff][f] != 0) {

it doesn't work because of this part:
Code: [ Select ]
int(0,9 * max[f])

but I don't know why.

Thanks again.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Posts: 778
  • Loc: In the heart of California, Fresno.

Post 3+ Months Ago

Code: [ Select ]
variable = "prix[0][1]";
  • Tony_Vallad
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9

Post 3+ Months Ago

OriginNO_II wrote:
Code: [ Select ]
variable = "prix[0][1]";


isn't there any better way? Can't I just do a loop?
  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Posts: 778
  • Loc: In the heart of California, Fresno.

Post 3+ Months Ago

Try it. See which way works best for you.
  • Tony_Vallad
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9

Post 3+ Months Ago

The problem is that I don't want to write all variables like that (47 in the table, that I will use several times). I need to do a loop, and by doing variable = "prix[0][1]" I won't be able to do one.

Look, I've gt a table of variables of 7x7.
I need to do a loop like:

Code: [ Select ]
for (f = 1; f < 8; f++) {
  if (prix[ff][f] > max[ff] and prix[ff][f] != 0) {
   "variable used to print in textboxes" = prix[ff][f]
  }
}
  1. for (f = 1; f < 8; f++) {
  2.   if (prix[ff][f] > max[ff] and prix[ff][f] != 0) {
  3.    "variable used to print in textboxes" = prix[ff][f]
  4.   }
  5. }


With variable = "prix[0][1]" I don't think I can do that.
  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Posts: 778
  • Loc: In the heart of California, Fresno.

Post 3+ Months Ago

Your right, that will not work. I thought you just wanted to know how to make your variable show in a text box.
  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Posts: 778
  • Loc: In the heart of California, Fresno.

Post 3+ Months Ago

What are you trying to accomplish with your script. What is prix[ff][f]
  • Tony_Vallad
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9

Post 3+ Months Ago

OriginNO_II wrote:
What are you trying to accomplish with your script. What is prix[ff][f].


Well, I'm doing a program (in flash) so as to simplify the commerce in an online game (DarkPirates).
I've already done it in QuickBasic language, but the presentation is really poor, so I've decided doing it on flash.

Ok, here's the idea:
In the game there are 7 planets, with 7 differend materials. To commerce you have to buy on one planet, then sell on an other one that has a higher prize. (selling prize = 90% * buying prize on the same planet).

My table is meant to show you where to buy and where to sell. That's why I need a loop.

The results will be shown as a table of 7x7 boxes. The color will change to different colours depending of what to do whith the materials on the planets.

Here's the program not working yet: http://tonyvallad.i f r a n c e.com/DPTC%20%5Bpresentation%5D.swf

To see the results do this:
- Click on login without putting anything in.
- Click on "Entrar Datos"
- Click on the button down the page.
- Click on the button "Calcular rutas"
and that's it, you'll see the results (not working of corse), but you'll have an idea of what I want to do.

The prix[f][ff] variable is for the prizes of the different materials (ff) on the different planets (f).
  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Posts: 778
  • Loc: In the heart of California, Fresno.

Post 3+ Months Ago

Your link is not working of course. If we could see it we could possibly help but your problem is very hard to visualize making it hard to solve.
  • Tony_Vallad
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9

Post 3+ Months Ago

Link corrected. Something changes the "i f r a n c e" into *spam*
Get the spaces between the letters off for the URL to work.

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.