
-----------------------------------
Vicous
Fri Mar 07, 2003 7:48 pm

need help with nity gritty of grids
-----------------------------------
I need to make a grid, assigning seperate variables to each square and seperating rows and columns by name( of the variable), and I need to do it in a for loop... eg.

for width:1..(width of grid)
     for hight:1..(hight of grid)
          var (width of grid) +","+ (hight of grid) :int
     end for
end for

and I need to get back variables like (if width of grid is 5 and hight of grid is 3)
1,1  1,2   1,3   1,4   1,5
2,1  2,2   2,3   2,4   2,5
3,1  3,2   3,3   3,4   3,5

I need this in order to make a map for an rpg style game, each variable will hold a number which will identify which chip from the chipset it will hold


I invite any other ideas too, but I need to be able to let the user to set the width and hight of the map and make sane(as in not insane) names for each variable in order to identify rows and coloumns

-----------------------------------
Asok
Fri Mar 07, 2003 8:14 pm


-----------------------------------
Make 2 varriables, one for the hieght of the grid and one for the length of the grid. Multiply those variables, the result is the amount of slots you will need in your array that will store the grid positions.

-----------------------------------
Vicous
Fri Mar 07, 2003 8:40 pm


-----------------------------------
I think you missed the point, and Im not that good with arrays anyway, infact I only know the basics but anyway this program will write a file that will be read later by the actual game, and I need to find a way to name the variables so that I know what they are, not just straight numbers

-----------------------------------
Tony
Fri Mar 07, 2003 9:06 pm


-----------------------------------
you cant declear a variable with a name specified by user... not unless you write an if statment for every possible input.

Just use 2D arrays. You can use variables to specify the size.

You can use a search feature to find some posts on arrays. I'm sure they're explained here somewhere

-----------------------------------
Vicous
Fri Mar 07, 2003 9:30 pm

O.K.
-----------------------------------
I get the point of arrays now, what do you mean by double array? instead of

var grid:array 1..10 of int

i declare this instead?

var grid:array 1..10,1..10 of int 
and each variable is grid(x)(x)?

-----------------------------------
Tony
Fri Mar 07, 2003 9:42 pm


-----------------------------------
almost

you got the declaration part right

var name:array 1..10, 1..10 of int

but you call the varaible inside a single bracket

name(2,5)

-----------------------------------
Vicous
Sat Mar 08, 2003 4:36 pm

more help
-----------------------------------
Ive also got a menu set up, how do I refresh it after i cls the screen?

-----------------------------------
Tony
Sat Mar 08, 2003 4:58 pm


-----------------------------------
you'd have to redraw everything after cls.

I recommend setting up a procedure for drawing each individual item, this way you can also redraw an object without clearing the whole screen.

-----------------------------------
Vicous
Sun Mar 09, 2003 4:31 pm

GUI
-----------------------------------
how do I refresh a GUI menu?

-----------------------------------
Tony
Sun Mar 09, 2003 5:13 pm


-----------------------------------
what do you use to create your GUI menu?

-----------------------------------
Vicous
Wed Mar 12, 2003 8:26 pm


-----------------------------------
file := GUI.CreateMenu ("File")
newmap := GUI.CreateMenuItem ("New Map", makenewmap)
exitWithoutSaving := GUI.CreateMenuItem ("Quit", GUI.Quit)

-----------------------------------
Tony
Wed Mar 12, 2003 11:03 pm


-----------------------------------
I donno why you should need to refresh your menu... You can use Enable and Disable to turn menu items on/off (like grey links you cant click in normal programs :wink:)

but if for some reason you do...

GUI.Dispose (widgetID : int)

this will get rid of your widget (menu item). Using this you can clear your whole menu and then fill it up with new menu items

-----------------------------------
Vicous
Thu Mar 13, 2003 11:46 am


-----------------------------------
If my program draws over the menu, or I use CLS to clear out my pictures, how would I redraw my menu without completly remaking my menu (I can't remake my menu, not the way I've got my program set up)

-----------------------------------
Tony
Thu Mar 13, 2003 12:57 pm


-----------------------------------
Here's whats going on. When you use cls the screen gets cleared, but the menus are still there. You can click on them and they would work :wink:

You can make the menu button appear by enabling it GUI.Enable (menuID)

though you'd have to redraw the line yourself :?
