|
Post by shiftybill on Mar 6, 2004 3:38:12 GMT -5
i would like help with the menu system in my battle room, you see i am planning to have alot of magic and summons in my rpg, i am having trouble making an array menu that has 30 selection but i only want 5 to be shown at any one time, thanks in adv
|
|
|
Post by IsmAvatar on Mar 6, 2004 14:05:21 GMT -5
Your question is a bit vague, but by the title, I'll help you the best I can.
I'm supposing you already know how to work arrays and the general area in there.
To get a menu of arrays scrollable, you use a separate variable that controls how far down in the menu you are. you then draw the options in the array from the menu_position variable down to menu_position + 5
and don't forget to add caches to your menu's, because otherwise you'll get an error of array index out of bounds. For further help, don't be afraid to ask, just don't be vague.
|
|
|
Post by shiftybill on Mar 6, 2004 18:25:54 GMT -5
i am a little confused how to draw it still ill show u my code
Create Event: execute code:
{ option[0]= 'One'; option[1]= 'Two'; option[2]= 'Three'; option[3]= 'Four'; option[4]= 'Five'; option[5]= 'Six'; option[6]= 'Seven'; option[7]= 'Eight'; option[8]= 'Nine'; option[9]= 'Ten'; select=0; font_size=24; font_name='times new roman'; menu_position=1; }
Draw Event: execute code:
font_align=fa_center; font_color=c_black; font_size=10; font_name='times new roman'; draw_text(room_width/2,175,'Use the up and down arrows to highlight an item, then press return')
{ font_align=fa_center; font_size=24; for (i=0;i<10;i+=1) { if i=select {font_color=c_red;} else {font_color=c_blue;} draw_text(room_width/2,room_height/3+(i*32),option); } } Key Press Event for <Enter> Key: execute code:
font_color=c_blue draw_text(room_width/2,10,option[select]+' is Highlighted');
screen_refresh();
keyboard_wait();
Key Press Event for <Up> Key: execute code:
{ if not select {select=9;} else {select-=1;} menu_position-=1; }
Key Press Event for <Down> Key: execute code:
{ if select==9 {select=9;} else {select+=1;} menu_position+=1; }
//smiley killed
|
|
|
Post by IsmAvatar on Mar 6, 2004 20:55:37 GMT -5
for (i=0;i<10;i+=1) { if i=select {font_color=c_red;} else {font_color=c_blue;} draw_text(room_width/2,room_height/3+(i*32),option[i]); }
to get this working, you should change this code to read like this instead:
for (i=menu_top;i<menu_top+10;i+=1) { if i=select {font_color=c_red;} else {font_color=c_blue;} draw_text(room_width/2,room_height/3+(i*32),option[i]); }
in down key event
while menu_position > 10 + menu_top { menu_top += 1 } while menu_position < menu_top { menu_top -= 1 }
and don't forget to initialize menu_top in the create event. All the 10's mentioned there are estimates, without testing, so if that doesn't work, don't be afraid to change the 10 to a 9. Also, when initializing menu_top, it should either be 1 or 0, but I didn't test it so I don't know right now.
hope this helps.
|
|
|
Post by shiftybill on Mar 7, 2004 5:01:40 GMT -5
ok my array menu is scrolling but not in the way i would like it to, the menu moves down as u scroll down, its hard to explain so ill post it on my site so u can see for yourself, my homepage is at www.freewebs.com/shifthouseedit: umm i cant access freewebs atm so ill post it asap
|
|
|
Post by IsmAvatar on Mar 7, 2004 14:26:23 GMT -5
can you give us a direct link to it so we know which one to download?
Also, please explain how to recreate the problem (in game), and which objects you think are responcible for the problem.
|
|
|
Post by shiftybill on Mar 8, 2004 2:42:16 GMT -5
heres the array menu it at www.freewebs.com/shifthouse/array.gmd ok, it draws the menu normally but only shows six at any one time, if you know what i mean? a menu system like final fantasy 5 is a good example as to what im trying to accomplish. thx alot
|
|
|
Post by IsmAvatar on Mar 8, 2004 16:01:26 GMT -5
I don't know what you're aiming at, so what I did was I made it so it stays in place (it doesn't keep crawling downwards), and it shows 5 objects at a time, rather than 6. userweb.nni.com/cmagicj/array.gmd
|
|
|
Post by shiftybill on Mar 9, 2004 2:48:44 GMT -5
thx alot!! exactly what i wanted!!! your a legend!!
|
|
|
Post by IsmAvatar on Mar 9, 2004 15:35:58 GMT -5
I know. And I also know that i'm gonna get a very nice spot in the credits
|
|