Author Topic: Danmakufu Q&A/Problem Thread  (Read 172190 times)

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #750 on: September 23, 2009, 09:38:02 PM »
Question: How can you play multiple stages? Putting them in a plural file won't work, so what is the right way to call them?
I want to make a main menu, but that's kinda pointless if you can't play stages afterwards!
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Kilgamayan

  • True
  • *
  • The Real Treasure Is You
    • Let's Play Super Marisa World
Re: Danmakufu Q&A/Problem Thread
« Reply #751 on: September 23, 2009, 09:42:52 PM »
Question: How can you play multiple stages? Putting them in a plural file won't work, so what is the right way to call them?
I want to make a main menu, but that's kinda pointless if you can't play stages afterwards!

Congratulations on post 77777.

Unfortunately, I have no actual answer to your question. :V
[22:40:12] <Drake> "guys i donwloaded esod but its not workan"
[22:40:21] <Drake> REPORTED
[22:40:25] <NaturallyOccurringChoja> PROBATED
[22:40:30] <Drake> ORGASM
[22:40:32] <NaturallyOccurringChoja> FUCK YEAH

[22:28:39] <Edible> Mafia would be a much easier game if we were playing "spot the asshole"

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread
« Reply #752 on: September 23, 2009, 11:17:47 PM »
Question: How can you play multiple stages? Putting them in a plural file won't work, so what is the right way to call them?
I want to make a main menu, but that's kinda pointless if you can't play stages afterwards!

main menu enemy to mess with DrawText and common data functions → multiple tasks for multiple difficulties and stages → mess with if statements in the stage script → make each task execute the next task
...Sorry if I messed something up.


Like this, I think.

Code: [Select]
script_stage_main{

 function Wait(let frames){
   loop(frames){yield;}
 }
 function WaitForZeroEnemy{
  while(GetEnemyNum != 0){yield;}
 }
 task select{
 //spawn main menu enemy;
 //spawn another menu enemy if you want because I did for the game I'm making;
 if(blahblahblahstatement) {
 stageE1;
 } else if(blah) {
 stageN1;
 } else if(blahthisistrue) {
 stageH1;
 } else if(blahblahblahblahtrueblahblah) {
 stageL1;
 } else if(truestatement) {
 stageEX;
 } else if(thisstatementistrue) {
 stagePHAN;
 }
 }
 task stageE1{
 //abcdefg stuff to spawn enemies for this stage;
 stageE2;
 }
 task stageE2{
 //abcdefg stuff to spawn enemies for this stage;
 stageE3;
 }
 task stageE3{
 //abcdefg stuff to spawn enemies for this stage;
 stageE4;
 }
 task stageE4{
 //abcdefg stuff to spawn enemies for this stage;
 stageE5;
 }
 task stageE5{
 //abcdefg stuff to spawn enemies for this stage;
 stageE6;
 }
 task stageE6{
 CopyPasta(FTW);
 Clear;
 }
 task stageN1{
 //abcdefg stuff to spawn enemies for this stage;
 stageN2;
 }
 task stageN2{
 //abcdefg stuff to spawn enemies for this stage;
 stageN3;
 }
 task stageN3{
 //abcdefg stuff to spawn enemies for this stage;
 stageN4;
 }
 task stageN4{
 //abcdefg stuff to spawn enemies for this stage;
 stageN5;
 }
 task stageN5{
 //abcdefg stuff to spawn enemies for this stage;
 stageN6;
 }
 task stageN6{
 //enemies;
 Clear;
 }
 task stageH1{
 //abcdefg stuff to spawn enemies for this stage;
 stageH2;
 }
 task stageH2{
 //abcdefg stuff to spawn enemies for this stage;
 stageH3;
 }
 task stageH3{
 //abcdefg stuff to spawn enemies for this stage;
 stageH4;
 }
 task stageH4{
 //abcdefg stuff to spawn enemies for this stage;
 stageH5;
 }
 task stageH5{
 //abcdefg stuff to spawn enemies for this stage;
 stageH6;
 }
 task stageH6{
 //lots of copy-pasting;
 Clear;
 }
 task stageL1{
 //abcdefg stuff to spawn enemies for this stage;
 stageL2;
 }
 task stageL2{
 //abcdefg stuff to spawn enemies for this stage;
 stageL3;
 }
 task stageL3{
 //abcdefg stuff to spawn enemies for this stage;
 stageL4;
 }
 task stageL4{
 //abcdefg stuff to spawn enemies for this stage;
 stageL5;
 }
 task stageL5{
 //abcdefg stuff to spawn enemies for this stage;
 stageL6;
 }
 task stageL6{
 //enemies;
 Clear;
 }
 task stageEX {
 //abcdefg stuff to spawn enemies for the EX stage;
 Clear;
 }
 task stagePHAN {
 //abcdefg stuff to spawn enemies for the Phantasm stage;
 Clear; //OMFG this script is long even without enemies
 }

  @Initialize{
 select;
  }
 @MainLoop{
   //Feel(Free, To, Make, This, Script, Shorter);
   yield;
  }
  @Background{

  }
  @Finalize{

  }
  //Shell copied from Naut;
}

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: Danmakufu Q&A/Problem Thread
« Reply #753 on: September 24, 2009, 01:55:44 AM »
Question: How can you play multiple stages? Putting them in a plural file won't work, so what is the right way to call them?
I want to make a main menu, but that's kinda pointless if you can't play stages afterwards!

main menu enemy to mess with DrawText and common data functions → multiple tasks for multiple difficulties and stages → mess with if statements in the stage script → make each task execute the next task
...Sorry if I messed something up.


Like this, I think.

Code: [Select]
t3h codez

This looks a lot like what I put together for the (now defunct) EoAD project - basically, each stage has its own function which is called from the top-level stage's @MainLoop.

Here's a couple things from my implementation that could improve on your sample ...
- Separate each stage's function to a separate script file, and include them in your main script file.  This allows you to keep things a bit more organized.
- Rather than a separate function for each difficulty, as it looks like you did in your sample, I recommend using common data to set a difficulty variable globally, and then adjusting factors as need be in each stage function.



Also, you can use the @Background of your main script to draw menus and such.  I normally do that with menus, and keep an in_menu variable to track whether we're currently in a menu or not.


Oh, and of course, I didn't use tasks 'cause I hate them.
to quote Naut:
"I can see the background, there are too many safespots."
:V

Re: Danmakufu Q&A/Problem Thread
« Reply #754 on: September 24, 2009, 04:09:57 AM »
i just have a quick question about all of the things you put in if(frame???400)
the ??? being

!=
=!

i read the tutorial on these and i dont quite get how these work,
 if 28!=4 is true i think, if frame28!=4 how the @#$@ does that work?
and sorry if my question is confusing

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #755 on: September 24, 2009, 08:40:53 AM »
i just have a quick question about all of the things you put in if(frame???400)
the ??? being

!=
=!

i read the tutorial on these and i dont quite get how these work,
 if 28!=4 is true i think, if frame28!=4 how the @#$@ does that work?
and sorry if my question is confusing

I'm not quite sure what you mean, but != means "if not"
So you probably mean:
Code: [Select]
if(frame!=4){ *stuff* }Which would cause "stuff" to happen on every frame, except on frame 4 (which is probably barely noticable). So you might want to combine it. Like:
Code: [Select]
if(frame!=4 && frame<20){ *stuff* }Or something like that.

My favorite way of making things happen is:
Code: [Select]
if(frame%20==0){ *stuff* }Which would make "stuff" happen every 20 frame, including the very first.

Oh, and =! only raises errors, != is the right way.




Anyhoo, back to my question:
I haven't dealt with functions before. Functions are another kind of sepparate files you can call on, right?
I have a Stage file here, so would it be possible to summon that by using a function? If so, how? The wiki on functions doesn't help me understand it much. D:
Making a main menu is not a problem, it's just that one little piece of "playing the stage" I'm missing.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #756 on: September 24, 2009, 02:06:39 PM »
you can simply declare variables, use tasks, subroutines or functions in another text file (e.g. "example.txt")

then you can use:
#include_function "..\example.txt"

to include all things in it.
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #757 on: September 24, 2009, 02:20:19 PM »
you can simply declare variables, use tasks, subroutines or functions in another text file (e.g. "example.txt")

then you can use:
#include_function "..\example.txt"

to include all things in it.

Geting closer. I have things set up like this right now:
Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Masahiro Main Menu]
#Text[Meep]
#Player[FREE]
#ScriptVersion[2]

#include_function "script\Stage 1.txt"

script_stage_main{
*stuff*

And after certain events I want to load said stage, so I put this down:
Code: [Select]
CreateEnemyBossFromFile("script\Stage 1.txt",cx,cy,0,0,NULL);Which ofcourse gives errors. That's probably not it, eh? Together with CreateEnemyFromFile it's the only piece of code that I can find where you can link to another file. What would be the right thing to put there instead?
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #758 on: September 24, 2009, 02:31:22 PM »
Geting closer. I have things set up like this right now:
Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Masahiro Main Menu]
#Text[Meep]
#Player[FREE]
#ScriptVersion[2]

#include_function "script\Stage 1.txt"

script_stage_main{
*stuff*

And after certain events I want to load said stage, so I put this down:
Code: [Select]
CreateEnemyBossFromFile("script\Stage 1.txt",cx,cy,0,0,NULL);Which ofcourse gives errors. That's probably not it, eh? Together with CreateEnemyFromFile it's the only piece of code that I can find where you can link to another file. What would be the right thing to put there instead?

Em... For me I would put the #include_function inside the script_stage_main, probably before initialize.
And I don't know much about stage scripts :( sorry for that
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #759 on: September 24, 2009, 02:36:14 PM »
Tried that too, but it gives other errors. I'll wait for someone else to answer it then :3
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread
« Reply #760 on: September 24, 2009, 03:38:38 PM »
#include_function just includes a script filled with information as if you wrote it down in your current script. So for stage1.txt you could have a task inside of it somewhere that loks like this:

Code: [Select]
task stage1{
//lololololololol
loop(infinity){
yield;}
//lololololololol
}

Then you could call upon that task in your main script:
Code: [Select]
if(frame==200){
stage1;
}

So at frame 200, the main file would play the task "stage1" as if you declared it in the current script.

Erm, remember that functions cannot use yield and tasks can, which is why I used them isntead of "function". Same applies for "sub".


Take a look at the CtC shot replace script to see how include function works. Declaring shotinit; in a script just loads shot data that you called upon using #include_function ".\lib\SHOT_REPLACE\shot_replace.dnh";

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #761 on: September 24, 2009, 04:59:31 PM »
And so I did:

It seems to actually call for the stage now, but I get this error:



Could this be because I have to remove a few parts of the stage script before it will work? I tried removing everything that comes before script_stage_main{, but then I just get the same error starting from that point.


#include_function just includes a script filled with information as if you wrote it down in your current script. So for stage1.txt you could have a task inside of it somewhere that loks like this:

Code: [Select]
task stage1{
//lololololololol
loop(infinity){
yield;}
//lololololololol
}

Then you could call upon that task in your main script:
Code: [Select]
if(frame==200){
stage1;
}

So at frame 200, the main file would play the task "stage1" as if you declared it in the current script.

Erm, remember that functions cannot use yield and tasks can, which is why I used them isntead of "function". Same applies for "sub".


Take a look at the CtC shot replace script to see how include function works. Declaring shotinit; in a script just loads shot data that you called upon using #include_function ".\lib\SHOT_REPLACE\shot_replace.dnh";
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread
« Reply #762 on: September 24, 2009, 06:11:56 PM »
stage1.txt:

Code: [Select]

let boss = GetCurrentScriptDirectory~"keinekamishirasawa.txt";
let enemy = GetCurrentScriptDirectory~"enemy1.txt";

task stage1{
loop(60){yield;}
loop(10){
   CreateEnemyFromFile(enemy, rand(50, 398), -20, 90, rand(2, 6), 0);
   loop(20){yield;}
   }
while(GetEnemyNum>0){
   yield;
   }
loop(30){yield;}
CreateEnemyBossFromFile(boss, 500, 0, 0, 0, 0);
while(IsBossExisting==true){
   yield;
   }
loop(120){yield;}
Clear;
}


This is all you need in the stage1.txt file, in it's entirety. No need for @MainLoop or any of that shit, just the functions, declarations, tasks or whatever. Then in your main file (the file you're declaring #include_function in) you could declare stage1 anywhere in the script and it will then play through the task stage1, since the file reads it as if you declared it within script_stage_main{}.

Erm, hopefully this is clear, heh.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #763 on: September 24, 2009, 06:18:38 PM »
Hm, so if I want to use a background, I can make a sepparate file for that too? I'll go mess with it for a bit...

Conclusion: A Stage script would be better defined as a Game script. Ne?
« Last Edit: September 24, 2009, 06:21:50 PM by puremrz »
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread
« Reply #764 on: September 24, 2009, 06:20:38 PM »
You can make a separate file for anything declarable in the main file (read: everything).

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #765 on: September 24, 2009, 06:59:06 PM »
My brain is fighting hard to prevent me from understanding, but I think I finally got it.
Although this progress has led me to another problem.

This is as far as I made it:

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Masahiro Main Menu]
#Text[Meep]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

#include_function "script\mainmenu ssm.txt"
#include_function "script\mainmenu init.txt"

mainmenussm;

@Initialize{
mainmenuinit;
}

*the rest*

The two files include:
Code: [Select]
task mainmenussm{

let easy=1;
let normal=0;
let hard=0;
let choice=("script\SoundEffects\choice.wav");
etc

}

and

Code: [Select]
task mainmenuinit{

LoadSE(choice);
LoadSE(confirm);
LoadSE(cancel);
etc

}

But when I try it out, Danmakufu tells me I hadn't set a variable for the "choice" sound effect, while I just loaded that from the first file.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread
« Reply #766 on: September 24, 2009, 07:02:55 PM »
You don't need to make a task to declare variables. Remember that tasks have their own scope, so when you declare a variable inside a task, it only exists inside that task. Just simply stating "let choice = whatever;" outside the task is fine (see: my previous example).

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #767 on: September 24, 2009, 07:24:54 PM »
Zomg, it finally worked! There's one downside with it though, I have to declare all variables for all stages in one single file. That can get messy... Let's see if I can find a way around that.

Edit: Dayumn, I was right about the messy variables. I was experiencing crashing errors for over an hour because of a doublenamed variable! >_<
And hour is very long if Danmakufu keeps crashing :P

You don't need to make a task to declare variables. Remember that tasks have their own scope, so when you declare a variable inside a task, it only exists inside that task. Just simply stating "let choice = whatever;" outside the task is fine (see: my previous example).
« Last Edit: September 24, 2009, 09:12:46 PM by puremrz »
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread
« Reply #768 on: September 25, 2009, 12:46:25 AM »
yay! another question about SetShotDataAs! I remember hearing about some sort of "return statement" does that make the bullet go back to the boss? or if not how do you have bullets return to the boss?

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #769 on: September 25, 2009, 02:50:27 AM »
yay! another question about SetShotDataAs! I remember hearing about some sort of "return statement" does that make the bullet go back to the boss? or if not how do you have bullets return to the boss?

hey...
no return is needed...
SetShotDataA(bullet_id, delay_frame, velocity, angle-180 (if linear), ...);
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #770 on: September 25, 2009, 08:37:38 AM »
yay! another question about SetShotDataAs! I remember hearing about some sort of "return statement" does that make the bullet go back to the boss? or if not how do you have bullets return to the boss?

"Return" is a general programming term; returns are data that are produced from functions that allow you to treat the function itself like a number (or in some cases, a string).

For instance, GetAngleToPlayer returns the angle from the boss to the player, so you can put it in mathematical statements. For instance,  n=GetAngleToPlayer. This won't work with a function that doesn't return anything, like, say, n=CreateShot01.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #771 on: September 25, 2009, 09:44:11 AM »
Is there a way to jump from one part of the script to the other? After certain events, @Initialize will contain new data, and I want the script to replay from that moment on.

Code: [Select]
@Initialize{
if(GetCommonData(5)==-1) { initmain; }
if(GetCommonData(5)>=0) { init1; }
yield;
}

@MainLoop{
if(GetCommonData(5)==-1) { mlmain; }
if(GetCommonData(5)>=0) { ml1; }
yield;
}

@BackGround{
if(GetCommonData(5)>=0) { bag1; }
yield;
}
Like this, CommonData(5) starts as -1, but at the end of the script, it becomes a bigger number. So I want to reload the whole script for each stage, since it's not possible to load a second stage file after clearing the first..


Really, making a stage alone sucks, but Danmakufu's lack of "You cleared this stage, now load the next" is completely retarded.
A stage file shouldn't be called like that if you can only run one of them. *rage*
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread
« Reply #772 on: September 25, 2009, 01:54:10 PM »
Make a plural file that plays the stages file in succession. Or make a task that will wait until the stage is finished, then plays it again with the updated common data.

Code: [Select]
task stages{
stage1;
while(stage1playing==true){
   //just set a variable to true while your stage is playing, and at the end set it to false to make this statement work.
   yield;
}
stage1;
while(stage1playing==true){
   yield;
}
stage2;
while(stage2playing==true){
   yield;
}
Clear;
}

Something like that. This also solves your "you cleared a stage, load the next" problem. That is, if you didn't like my plural file + stages in succession idea at first...

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #773 on: September 25, 2009, 02:41:10 PM »
When I make a plural file and try to load a stage script, it say something about setting the enemy's health, and then crashes. So it won't allow you to load a stage from a plural.

When I make a task out of the stage and try to load that from another stage, it gives me the error you get when your } count is wrong. And crashes afterwards, even if the { and } count is completely right.

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Thing]
#Text[]
#Player[FREE]
#ScriptVersion[2]

#include_function "script\Stages\Stage 1b.txt"

stage;
This is the whole file where I try loading the stages from.

Code: [Select]
task stage{

script_stage_main{

@Initialize{
}

@MainLoop{
}

@BackGround{
}

@DrawLoop{
}

@Finalize{
}
}
}
This is what I'm loading.
Even though there's nothing in there, Danmakufu won't accept it and crashes. It's like you can't put @Initialize & friends in a task.



I tried your other ways too:
Code: [Select]
@Initialize{
if(GetCommonData(5)==0) { initmain; }
yield;
}

@MainLoop{
if(GetCommonData(5)==0) { mlmain; }
yield;
}
it somewhat works, although it gave me countless problems related to variables it claimed not to have, while I created those right before calling the task. And I can't load Initialize a 2nd or 3rd time, so this won't work.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread
« Reply #774 on: September 25, 2009, 02:48:53 PM »
Eh, could be me ( replying from work ) but task stage and putting script_stage_main is not liked by Danmakufu. Or am I wrong here.

Re: Danmakufu Q&A/Problem Thread
« Reply #775 on: September 25, 2009, 03:38:22 PM »
Ahhhhhh! When I said my example script was the entirety of stage1.txt -- I MEANT IT. That is seriously all you need to put in the file. Just the task! No script_stage_main, no @Initialize, nothing! Just the task! All the @Initialize portions and whatnot happens in the main file! You can load all your graphics and whatever else in the main file! So delete all of that @Initialize and stage_script_main shit and just program your stage using yield; and CreateEnemyFromScript functions in the task. Run the task in your main file, just like my example script. Viola!

Also, come on IRC! It's so much easier to explain this stuff in real time, since I'm clearly not doing this subject justice, haha.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #776 on: September 25, 2009, 03:54:06 PM »
Eh, could be me ( replying from work ) but task stage and putting script_stage_main is not liked by Danmakufu. Or am I wrong here.

Nope :<

Now I tried this instead:
Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Thing]
#Text[]
#Player[FREE]
#ScriptVersion[2]

#include_function "script\Stages\Stage 1b.txt"

script_stage_main{

stage1load;

}

And then the task file has the whole stage minus the part before script_stage_main and the last }
In other words, these two, when merged, form the exact same file of a stage that normally would work.

When loading that, Danmakufu goes like

and closes the stage (It doesn't crash, that's a breakthrough. No really, I've had to restart it so many times last two days, if I got a cent for each crash, I'd be able to buy a very expensive icecream now.
Removing stage1load; results in an empty typical screen. Which is ofcourse more pleasant than that windows error sound followed by "Would you like to send this error report so that Microsoft can point at you and laugh?"


It's like Danmakufu isn't made to play more than one stage at a time. The only way I can find around it is to use SaveCommondata and then manually load each stage. How did those people from CtC do it? I can't make sense out of their scripts, it's like it's written with a completely different language than Danmakufu uses.



Naut: Warning - while you were typing a new reply has been posted. You may wish to review your post.
That warning thing is pretty useful.

Oh bugger, but I'll post this anyway.
I think I tried doing that with the entire stage as well. But I can try again, maybe it works this time.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread
« Reply #777 on: September 25, 2009, 04:04:30 PM »
Main stage file:

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Stage lokloooloolol]
#Text[OMGOMGOMGOGM]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{
   #include_function "script\Stages\Stage 1b.txt";

   @Initialize{
      stage1load;
   }

   @MainLoop{
      yield;
   }

   @Finalize{

   }
}

Stage 1b.txt:

Code: [Select]

let boss = GetCurrentScriptDirectory~"keinekamishirasawa.txt";
let enemy = GetCurrentScriptDirectory~"enemy1.txt";

task stage1load{
loop(60){yield;}
loop(10){
   CreateEnemyFromFile(enemy, rand(50, 398), -20, 90, rand(2, 6), 0);
   loop(20){yield;}
   }
while(GetEnemyNum>0){
   yield;
   }
loop(30){yield;}
CreateEnemyBossFromFile(boss, 500, 0, 0, 0, 0);
while(IsBossExisting==true){
   yield;
   }
loop(120){yield;}
Clear;
}

This will run, provided you have the files I declared (just substitute your own or whatever).

Re: Danmakufu Q&A/Problem Thread
« Reply #778 on: September 25, 2009, 04:16:14 PM »
Ah shit, you use @MainLoop. Okay, let's make a second @MainLoop.

mainstage.txt:

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Stage lokloooloolol]
#Text[OMGOMGOMGOGM]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{
   #include_function "script\Stages\Stage 1b.txt";

   @Initialize{
      stage1load;
   }

   @MainLoop{
      yield;
   }

   @Finalize{

   }
}

Stage 1b.txt:

Code: [Select]

task stage1load{

let frame = 0;
let enemy = GetCurrentScriptDirectory~"enemy.txt";
let boss = GetCurrentScriptDirectory~"rigorunaitobagu.txt";


loop{
   frame++;

   if(frame==40){
      CreateEnemyFromFile(enemy, rand(50, 398), -20, 90, rand(2, 6), 0);
   }

   if(frame==60){
      loop(6){
         CreateEnemyFromFile(enemy, rand(50, 398), -20, 90, rand(2, 6), 0);
      }
   }

   if(frame==120){
      CreateEnemyBossFromFile(boss, 500, 0, 0, 0, 0);
   }

   if(IsBossExisting==true){
      frame--;
   }

   if(frame==200){
      Clear;
   }
   yield;
}

}

Something like that. As you can see, we loop the whole task permanently, just like @MainLoop (it doesn't crash because we yield; everytime we loop, so every frame. Make sure you remember the yield!). This way you can implement your conditional statement way of coding.
« Last Edit: September 25, 2009, 04:18:16 PM by Naut »

Re: Danmakufu Q&A/Problem Thread
« Reply #779 on: September 26, 2009, 02:29:13 PM »
yay! another question about SetShotDataAs! I remember hearing about some sort of "return statement" does that make the bullet go back to the boss? or if not how do you have bullets return to the boss?

hey...
no return is needed...
SetShotDataA(bullet_id, delay_frame, velocity, angle-180 (if linear), ...);

What if the first data is the angle is random? would angle still work?
....