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

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #660 on: April 30, 2010, 04:58:09 AM »
Another problem:

I would like to make a SFX for shooting boss like in Touhou games (best demonstrated in SA Phantasm's script)

However, what's the difference between GetEnemyLife and GetLife?

For functions without parameters, the brackets not necessary, right?

GetLife returns the life of the current enemy (whose script it is being called in). GetEnemyLife returns the life of the current BOSS, no matter where it's being called.

Functions without parameters do not need brackets ( p.s.: they're actually called parentheses, brackets are the square ones, like these --> [ ] ).

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #661 on: April 30, 2010, 05:01:00 AM »
I have some little questions about the use of "yield;" command. As I know, it is used to link the @MainLoop to other task.

1. Can 1 yield; command in @MainLoop be connected to all other yield; in tasks?
2. Can 1 yield; command in tasks be connected to all other yield;s?
3. Can I put a yield; command in @DrawLoop?

The word "link" isn't the best way to describe how yielding works. This is how tasks behave step by step. First take a look at this code:

Code: [Select]
@Initialize {
    taskOne;
    taskTwo;
    taskThree;
}

@MainLoop {
    yield;
}

task taskOne {
    yield;
    loop {
        CreateShot01(GetX, GetY, rand(0, 5), rand(0, 360), BLUE01, 5);
        loop(5){
            yield;
        }
    }
}

task taskTwo {
    loop(60){
        yield;
    }
    // Create an effect or something, I dunno.
}

task taskThree {
    loop {
        CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED03, 10);
        loop(12){
            yield;
        }
    }
}

So first, when it goes into @Initialize, the first thing it does is go into taskOne. The very first thing is taskOne is a yield, which in a task means to pause the task until a yield is encountered outside of any task. Since taskOne is paused now, it continues where it left off in @Initialize and starts up taskTwo. The first thing in taskTwo is also a yield (or rather, 60 yields) so it pauses taskTwo and goes on where it left off in @Initialize again. Therefore it starts up taskThree, which finally doesn't have a yield in front so the script does something, fire a bullet at the player. After that, taskThree encounters a yield and so pauses itself like the other two tasks and goes back to where it left off, which is the end of @Initialize.

Since @Initialize is done, we go into @DrawLoop (yes @DrawLoop is first), but there is none so it goes to @MainLoop. @MainLoop has a single yield. This is the yield that I meant when I said that the tasks are paused until a yield is encountered outside of any task. At this yield, any task that has not finished yet will be continued in the order that they were started. In this example, none of the three tasks have finished yet (and really only one will ever finish because the other two are infinite loops) so it goes to the first task we ever started, taskOne and continues where it left off, the beginning of the infinite loop. It shoots a blue bullet at a random angle and speed before encountering a yield again. taskTwo gets another yield so it immediately repauses itself, and taskTwo also gets a yield so it immediately repauses itself. Now that all the tasks are either finished or repaused, it goes back to the @MainLoop past where the yield is. The MainLoop is done, so the game waits for 1/60 of a second and then loops back to the beginning of the @MainLoop. This continues over and over, resulting in a random bullet every 5 frames, an aimed bullet every 12 frames, and an effect created 60 frames after the start of the script.

As said earlier, you are allowed to put a yield in @DrawLoop as well, but it is not recommended. Since all commands that are supposed to be run in that frame when the tasks continue themselves will be piled into the @DrawLoop instead of the @MainLoop, many unexpected errors may occur. Also if you have a yield in @DrawLoop and in @MainLoop, since there would be two yields per frame, it would cause the script to run two times faster.


Warning - while you were typing 5 new replies have been posted. You may wish to review your post.
....lol
« Last Edit: April 30, 2010, 05:03:09 AM by Blargel »
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #662 on: April 30, 2010, 05:17:47 AM »
LOL

Code: [Select]
task HitBoss{
   yield;
   let life = GetEnemyLife;
   let maxlife = life;
   yield;
   loop{
      if(!(GetEnemyLife==life)){
life = GetEnemyLife;
if(life<(maxlife/10)){
    PlaySE(SE_HIT1);
}else{PlaySE(SE_HIT2);}
      }
      loop(5){yield;}
   }
}

So I bet this task is to be declared only at the beginning of the script, right?
Old/Forgotten member.

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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #663 on: April 30, 2010, 05:27:10 AM »
That's definitely something to be called in @Initialize only because if you try it in @MainLoop, it'll create 60 new tasks that do the same thing every second, causing you to have an extremely large amount of redundant tasks that would potentially slow down Danmakufu considerably.

However, there are some tasks that could be called every frame without problems, though I don't have an example right off the bat.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #664 on: April 30, 2010, 05:30:06 AM »
Something like task setstuff { SetObjectStuff; }

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #665 on: April 30, 2010, 05:34:30 AM »
Using a task to create an object bullet/effect would be something you can call every frame, since the task would end when the bullet is deleted.

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #666 on: April 30, 2010, 05:38:06 AM »
The main problem is no SFX is produced.
My first diagnosis (:P) shows that if first yield; is removed like the following:

Code: [Select]
task HitBoss{
   //yield;
   let life=GetEnemyLife;
   let maxlife=life;
   if(frame%5==0){ascent(i in 0..life){CreateShot01(GetX, GetY, 2, 360/life*i, 0, 10);}}
   if(life==0){CreateShot01(GetX, GetY, 2, GetAngleToPlayer, 0, 10);}
   yield;
   loop{
      if(GetEnemyLife!=life){
life=GetEnemyLife;
if(life<(maxlife/10)){
    PlaySE("script\Patchouli\SFX\damage00.wav");
}else{PlaySE("script\Patchouli\SFX\damage01.wav");}
      }
      loop(5){yield;}
   }
}

There are bullets, but SFX not produced. (meaning value of life is correct)

I do have a yield; in MainLoop.

To your reference, here are some related function/task/loops:

Code: [Select]
sub bossSC{
   if(frame==-120){HitBoss;}
   //Stuffs here, used to draw boss and it doesn't have yield;
}
@DrawLoop {
   bossSC;
}
« Last Edit: April 30, 2010, 05:43:22 AM by Henry »
Old/Forgotten member.

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

空SoraのNo鏡Kagami

  • Wolven Wind Warrior of the West (That's catchy)
  • Occupation: Hopeless Amazing Young Scriptor
Re: Doesn't get objects
« Reply #667 on: May 01, 2010, 01:39:59 AM »
There's a lot more things you can do with variables so you should read some of the beginner tutorials in the tutorial thread to fully understand it. Objects rely heavily on manipulation of variables so it would be best if you learned variables first.

Yeah, i guess you have a point. I'm only 13 after all. Although, if I don't look at it and try, I'll NEVER get it... So wish me luck. Blah, blah, blah.
Me: Rapture is comin'
Person: OMG WHEN!
Me: Naow, APOCALYPSE SIGN "RAPTURE"!

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Doesn't get objects
« Reply #668 on: May 01, 2010, 02:03:24 AM »
Yeah, i guess you have a point. I'm only 13 after all. Although, if I don't look at it and try, I'll NEVER get it... So wish me luck. Blah, blah, blah.

You may be one of the youngest people here... I'm just 15 and I thought I was the youngest here :V (though, I started using danmakufu at 14 :/ )
« Last Edit: May 01, 2010, 02:05:41 AM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Nazo

Re: Danmakufu Q&A/Problem Thread v3
« Reply #669 on: May 01, 2010, 03:55:00 AM »
It may be something with the game, but, when I try to start up a script from the Directory (in game), it gives me an error and shuts down.
                                                                                                ?
Would anyone like to tell me what I'm doing wrong?  :derp:

(Before you ask, yes, I'm new to this.)

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #670 on: May 01, 2010, 03:58:34 AM »
It may be something with the game, but, when I try to start up a script from the Directory (in game), it gives me an error and shuts down.
                                                                                                ?
Would anyone like to tell me what I'm doing wrong?  :derp:

(Before you ask, yes, I'm new to this.)

Is it a certain script or all scripts?

also... I didn't know you could put a question mark like that :V
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #671 on: May 01, 2010, 04:01:54 AM »
You're using applocale, right?

Areylie

  • Cirno's Sister
    • Lymia's Website
Re: Doesn't get objects
« Reply #672 on: May 01, 2010, 04:08:09 AM »
You may be one of the youngest people here... I'm just 15 and I thought I was the youngest here :V (though, I started using danmakufu at 14 :/ )
I started using Danmakufu at 11-12, and am now 13. :V

note that I am the creator of the shot replace script :c

It may be something with the game, but, when I try to start up a script from the Directory (in game), it gives me an error and shuts down.
                                                                                                ?
Would anyone like to tell me what I'm doing wrong?  :derp:

(Before you ask, yes, I'm new to this.)

Care to answer 2 questions?

A) Do any other modes cause errors?
B) Are you running the game under either AppLocale, or have your system locale set to Japanese?
[Geek code (3.12): GCS/H/M d+(-) s+:->--:- a--->? C+(++++)>$ UL++@ P+(++) L+++ E- W++ N o K? w-@ O- M- V? PS++@ PE>- Y+ PGP++ t- 5? X? R+@ tv- b+(++) DI D-- G? e>+++(++++) h! r++ x-]
[Furry code (1.3): FFm1r A !C D? H+++ M? P++++ R-- T W !Z Sf! RLCT a- cl+~++++>$ d--- e>+++ f? h* i++/+++ j+ p+ sf!]

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #673 on: May 01, 2010, 10:06:13 PM »
Is there any way to mute the built-in sound effects in Danmakufu?

Edit: Well, I suppose I could just replace the actual sound effect files themselves in th_dnh.dat with blank files, but I'm looking for a less messy solution :/
« Last Edit: May 01, 2010, 10:15:07 PM by Bitz »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #674 on: May 01, 2010, 10:19:05 PM »
Make a blank sound file and name them as so


seGraze
seScore
seEnemyExplode01
seBomb_MarisaAseBomb_MarisaA_Star
seBomb_MarisaB


They are all .wavs

Re: Danmakufu Q&A/Problem Thread v3
« Reply #675 on: May 01, 2010, 11:46:51 PM »
Is there any way to mute the built-in sound effects in Danmakufu?

When on the frame (or frame after) you know it starts playing:

StopSE(seSuperNaturalBorder01.wav);

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #676 on: May 02, 2010, 01:28:17 AM »
Thanks!

Another question: would you (the replier) recommend, for timing danmaku/stages, a task with yields, or a if/then-type structure using a time variable that gets incremented each frame? I.e.,
Code: [Select]
task Pewpew {
   yield;
   while (1) {
      loop (60) {yield;}
      //Shoot stuff here
   }
}
versus
Code: [Select]
let time = 0;
@MainLoop {
   if (time%60 == 0) {
      //Shoot stuff here
   }
   time++;
}

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #677 on: May 02, 2010, 01:43:28 AM »
Entirely personal preference and how well you are at organizing either method.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #678 on: May 02, 2010, 01:46:38 AM »
Most people prefer using tasks, so that you can "insert" something in the middle without having to adjust everything after it. Plus, it makes it much easier to set variable times, such as waiting for the midboss to die before moving on.

Also, you can just use loop{stuff;} to loop infinitely. It will work the exact same, but it looks a bit nicer in my opinion.

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #679 on: May 02, 2010, 03:31:04 AM »
Tasks look neater, but if/then structures are more flexible; I run into a bit of trouble when trying to convert my if/then structures into tasks.

When on the frame (or frame after) you know it starts playing:

StopSE(seSuperNaturalBorder01.wav);

Actually, that doesn't work. :ohdear:

Re: Danmakufu Q&A/Problem Thread v3
« Reply #680 on: May 02, 2010, 03:35:09 AM »
What sound are you trying to stop?

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #681 on: May 02, 2010, 03:57:38 AM »
What sound are you trying to stop?

Essentially, I have
Code: [Select]
SetScore(900001);
StopSE(seUseSpellCard.wav);
in @MainLoop, which gives me an error on line 2.
With quotes around seUseSpellCard.wav, it runs without any errors, but the sound doesn't get stopped.

Danmakufu error
« Reply #682 on: May 02, 2010, 07:45:31 AM »
Hello everyone.
Yesterday I downloaded Danmakufu, only to find that it's not working. =/
Before I can even do anything, right after opening Danmakufu, I get this error:
"th_dnh.exe has encountered a problem and will therfore close.".
And yes, I am running it in Japanese.
I also have Windows XP, if that helps.

Can anyone solve this problem?

Thanks in advance! =D

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #683 on: May 02, 2010, 08:23:19 AM »
NicePianoPlayer,

Welcome to Rika's and Nitori's Garage. Please make sure you post all dnh "help me" related thinks in this thread as the thread exists here for a reason. To play Danmakufu or use it, you need to install and configure Applocal from Microsoft.

Please read this thread for detailed information: http://www.shrinemaiden.org/forum/index.php?topic=4138.0

Re: Danmakufu Q&A/Problem Thread v3
« Reply #684 on: May 02, 2010, 08:43:56 AM »
NicePianoPlayer,

Welcome to Rika's and Nitori's Garage. Please make sure you post all dnh "help me" related thinks in this thread as the thread exists here for a reason. To play Danmakufu or use it, you need to install and configure Applocal from Microsoft.

Please read this thread for detailed information: http://www.shrinemaiden.org/forum/index.php?topic=4138.0

I will do so next time, but I already tried the solution you offer and it's still not working...

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #685 on: May 02, 2010, 08:49:18 AM »
Offhand the only thing I know of that causes Windows crash errors at startup is when Danmakufu is trying to load something it doesn't like. Is it a clean Danmakufu folder or did you drop a bunch of scripts and stuff in there before starting it up?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #686 on: May 02, 2010, 08:59:27 AM »
Offhand the only thing I know of that causes Windows crash errors at startup is when Danmakufu is trying to load something it doesn't like. Is it a clean Danmakufu folder or did you drop a bunch of scripts and stuff in there before starting it up?

I downloaded it from the touhou wiki site. And yes, I think there are some scripts inside. I'll try launching without them. =)

Update: Still not working after I cleaned all of the folders. >_<

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #687 on: May 02, 2010, 09:15:26 AM »
I highly doubt the method being described in the thread fails. I am still sensing that you are not actually launching the game using the shortcut created by Applocal. The danmakufu zip from the wiki contains only Ex Rumia afaik. And those always work as the integrity is checked often.

Explain to us step by step what you did and trying to do. Screenshots would be even better along with it.

Shade

  • Narb Overlord
  • There are OVER 9000! Bullets flying on the screen!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #688 on: May 02, 2010, 03:28:18 PM »
I'm not really sure if this should go here but anyway...   :/

I download Concealed the Conclusion  cause it looked pretty good, I merged all the files and  tried it out to come across a error that I have received countless times before. "th_dnh.exe has encountered a problem and needs to close.  We are sorry for the inconvenience."

So I did what I did with the other times, I updated stuff. I tried it again, and had the same error. Now I had no idea what to do, and figured out I needed applocale. I downloaded that, and ran it with one of the box 'language' (Fourth one from the top) And it still doesn't work.

Do I have to download that specific font to make it work?

Thanks,
Shade.
I don't have a life, I has thousands! :D

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #689 on: May 02, 2010, 03:46:45 PM »
ran it with one of the box 'language' (Fourth one from the top)
sorry if I misunderstood what you said but... danmakufu runs with japanese... it's usually the last on the language list of applocale...

also, what do you mean by "merged all the files"?

another thing... from previous experience, no, you don't need to download any font to make applocale work...
« Last Edit: May 02, 2010, 03:48:54 PM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry