Page 1 of 1

RPG List Function Set

PostPosted: Tue Jan 06, 2009 10:53 pm
by pyrometal
Hello Everyone! I just finished making a demo of how to make an RPG item storage list for Bee-Ant's new game and I thought this could be useful to other more advanced users out there. I also included a text actor to print out the contents of the 2 arrays (it suggests a way to use the system).

Features:
- Item autostacking.
- Slot clearing.
- Item Consumption algorithm.
- Automatic Spacial Rearangement.
- Simple enough to use with fair ease.

Here are some limitations:
- Maximum of 16 item slots.
- Maximum of 99 stacked items in a single slot. (can be increased)
- Maximum of 10 characters for an item's name.
- The two arrays can be saved using GE's saveVars(); function (do that yourself though, it's easy)

The 3 Functions:
(1) add_item("item_name", amount); adds "amount" of "item_name" to the list.
(2) use_item("item_name", amount); uses "amount" of "item_name" from the list.
(3) clear_slot(slot_number); automatically clears the specified slot and reorganizes the list.

list demo.zip
GED demo file
(197.66 KiB) Downloaded 117 times

Re: RPG List Function Set

PostPosted: Tue Jan 06, 2009 11:45 pm
by jimmynewguy
neeto, checking it out now!

Re: RPG List Function Set

PostPosted: Wed Jan 07, 2009 10:37 pm
by zygoth
Nice, I understand most of what you did...arrays are very useful for stuff like this. I just recently looked up how to use them.

Re: RPG List Function Set

PostPosted: Wed Jan 07, 2009 11:00 pm
by pyrometal
I would normally be using a "struct" for this type of thing, but Bee-Ant wanted to have the ability to save using saveVars(); that's the only reason I ended up not doing so. Hopefully people find this demo helpful.

Re: RPG List Function Set

PostPosted: Thu Jan 08, 2009 1:27 pm
by Bee-Ant
Arigato pyro
You are so helpfull :D
DOnt worry, I will ask you for more demo later :P :mrgreen:

Re: RPG List Function Set

PostPosted: Thu Jan 08, 2009 2:04 pm
by pyrometal
I'll be waiting!

Re: RPG List Function Set

PostPosted: Thu Jan 08, 2009 2:22 pm
by Bee-Ant
Right now I just need some ideas...
viewtopic.php?f=4&t=6421&start=15

Re: RPG List Function Set

PostPosted: Sat Jan 17, 2009 1:13 pm
by Bee-Ant
I get some problem...
Here's the game data..
1. How to show Item Info depend on collided list text with the list box
2. How to toss the item depend on collided list text with the list box...
Ah, you will understand what I mean after you see this... :roll: :(

Re: RPG List Function Set

PostPosted: Sat Jan 17, 2009 3:51 pm
by pyrometal
Here, I fixed all your bugs and also modified the code to suit your needs better! From now on, if you want to change the amount of items you can carry, just change the variable MAX_ITEMS value to the amount you want! You had the right idea in your code, but your weren't referencing the correct variables for the job in some places, I'm sure you will see those when you take a look at what I've modified. Anyway, this menu looks really good so far! Keep up the excellent work Bee-Ant!

LISTDEMO.zip
Fixed!
(328.03 KiB) Downloaded 96 times


--pyro

Re: RPG List Function Set

PostPosted: Tue Jan 20, 2009 11:34 pm
by Bee-Ant
Thanks pyro :D
No question for now.its so clear.
Btw i used the strcmp method for the move and it works :o
I wanted to ask you about canvas,but it seems i already done it. Well,catch ya later.