{F} HALP!

Posted by Fabio on Nov. 22, 2007, 12:17 p.m.

What is wrong with this ds_list method?

songn = ds_list_create()

var f;

f = file_text_open_read(argument1)

while (!file_text_eof(f)) {

ds_list_add(file_text_read_string(f),"song")

file_text_readln(f)

}

I posted this on the GMC, maybe I'll get more help here.

Hey, I'm working on a GH like game for GM, Keyboard Hero. It's coming along wonderfully, with its very own track creator, saver, and loader. It saves your own custom tracks onto a special .KHS file.

Everything would work fine, but two things are wrong:

1: In the objplaysong2 Step event, when playing is true, it executes the .KHS file, which tells the game when to create what note. Now this works fine, but when the songs get longer, it gets laggy. How can I simply upload the file once to the game instead of constantly executing it?

2: In the Composer, when you create a song (which works great), you can't play notes for the first second/half-second of the song, because the game determines when to create the notes by a 'cstep' variable, which starts at zero. Now, it takes time for the note to get to the area where you hit it, and that time is subtracted according to the difficulty. But, if the 'cstep' variable goes into a negative number, it won't create those notes when playing. What's wrong?

Any help would be greatly appreciated.

Download it here: http://64digits.com/users/Fabio/keyboard_hero.gm6

(Doesn't have everything like holding notes, etc. in it, this is just to help my problems.)

Comments

basilamer 17 years, 1 month ago

How do I create a note?

Requiem 17 years, 1 month ago

Make it load the notes from the KHS into a ds_list or an array instead of executing the thing every step.

Fabio 17 years, 1 month ago

How do I use ds_lists? I don't think I ever had before. Any examples? To create a note, press any of the function keys and enter. (F1 = green, F2 = red, etc.)

Josea 17 years, 1 month ago

RTFM. Go to the manual and look up for GML > Data Structures > Lists. There you'll see everything you need to know to use them.

They're pretty simple, you create a ds_list, the function returns the ID, then you keep adding or removing items to th list, like…eh, a list.

Bryan 17 years, 1 month ago

Seriously!?

Fabio 17 years, 1 month ago

Wow, I still can't do this. I tried ds_lists, read about it, and I'm still screwed.

DesertFox 17 years, 1 month ago

Then don't ever get into real programming if ds_lists confuse you. They are really really easy.

Fabio 17 years, 1 month ago

They seemed so, but I keep getting a damn 'file not opened for reading' error every time I try to use this. I don't get what I'm doing wrong.

beam 17 years ago

desertfox is a real programmer