Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [GM]Array Tutorial, Game Maker, or anything with C scripting
Rukiri
post May 18 2009, 02:22 PM
Post #1


emerge -avt awesome! Wait... it brings me.... HERE?!
Group Icon

Group: Revolutionary
Posts: 1,723
Type: Scripter
RM Skill: Advanced




This tutorial will cover arrays, I'm basically going to show you how to right a menu system using arrays. Of course, this is just text, not the menu itself. "Think I'd give you that much code?"

Variables:

selected = 1; // Option selected
page = 0; // in 2D arrays it's wise to create a variable for the page number.

Array:

menu[0,0] = 3; // The max options for the array
menu[0,1] = "Stats";
menu[0,2] = "Save";
menu[0,3] = "Quit";

Drawing the array:

for (i=0; i<=menu[page,0]; i+=1)
{
draw_text(x,y+(i*16)-16,string(menu[page,i]
}

If you want to color your text, for the selected option, just use a simple method like this.

if (selected = i)
{
draw_set_color(c_aqua);
}
else
{
draw_set_color(c_white);
}

^. Place above draw_text.

Example of such a menu:


__________________________
Xeilsoft
- Follow your dreams to the very end..

Kits that I'm working on.
[Unity3D 4.0] LTTP/Minish Cap - I don't have time for custom gfx like what the pze folks are doing but I will try and work on some enhanced LTTP graphics.

Main PC
Core i7 3820 overclocked @ 4.8GHZ
Galaxy: Nvidia Geforce GTX 680 GDDR5 2GB
Asrock X79 Extreme9 w' creative sound
64GB corsair platinum @ 1600MHZ
Muchkin 128GB SSD(boot), OZKIN 2TB SSD, Western Digital GREEN 1TB HDD.
Rosewill Lightning 1000W PSU
OS: Funtoo Linux, Windows 8 (Virtual Machine)

iMac (March 2013)
3.4GHz Quad-core Intel Core i7, Turbo Boost up to 3.9GHz
16GB 1600MHz DDR3 SDRAM - 2X8GB
1TB Serial ATA Drive @ 7200 rpm
NVIDIA GeForce GTX 680MX 2GB GDDR5
Go to the top of the page
 
+Quote Post
   
LarsonCreativity
post May 18 2009, 03:55 PM
Post #2


Level 4
Group Icon

Group: Member
Posts: 47
Type: None
RM Skill: Undisclosed




That is a very good example. I usaully do my menus differently, but your way takes a lot less code, not to mention uses arrays. This also gave me an idea of something I can do in C#.

~LC~
Go to the top of the page
 
+Quote Post
   
HeroOfHyla
post May 19 2009, 02:52 PM
Post #3


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




Huh, I never really thought of using an array for the menu. Although I've never really tried to make one before anyway, so I dunno what I would have come up with.

Nice idea, nice tutorial!


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   
onidsouza
post Jun 2 2009, 11:08 AM
Post #4


image master of doom
Group Icon

Group: Revolutionary
Posts: 603
Type: None
RM Skill: Undisclosed




Arrays in various languages:

CODE
# C++
int myNumbers[100]

# Pascal
myNumbers :array[0..10] of integer

# Ruby
myNumbers = [ ]

# Java
I really don't know. Learning java, still a big noob.


__________________________
Gabba Gabba Hey! enjoy your life ^^
lol (by keet's brother)
some lol
more lol
even MORE lol
Serious Discussion
why all my lol's have Teh Parakeet involved?

me ^^

bacon

Spamming is always better with bacon
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd May 2013 - 09:07 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker