Author Topic: Danmakufu Q&A Thread 4 - V3 Edition.  (Read 1197 times)

0 Members and 2 Guests are viewing this topic.

WishMakers

  • Myouren's IT Guy
  • *
  • Ada.Text_IO.Put("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Danmakufu Q&A Thread 4 - V3 Edition.
« on: April 19, 2020, 08:05:10 PM »
Welcome to the Danmakufu Q/A thread!  This is a continuation of the V2 thread, finally back in action.
Ask your questions here should you have a problem with Danmakufu, be it an error that you can't find, problem with the program, etc.

Previous thread
Danmakufu Wiki
DNH Function Docs
Major Info Thread
« Last Edit: May 15, 2020, 07:07:04 AM by Tom »
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #1 on: April 26, 2020, 02:18:17 AM »
I'm having trouble animating a "gravitational aura" around a boss. The only Danmakufu scripts I've come across that have made use of these can be found here (https://www.youtube.com/watch?v=2hVmjJrUzmM) and here (https://www.youtube.com/watch?v=bxf9Hvkx5oE). In case I'm not clear, I mean the circle around the boss that causes the background to pulsate and warp. I've examined both of these scripts' code and am still unsure how it was accomplished. Can someone help?

EDIT: Nevermind, I got it to work!
« Last Edit: April 30, 2020, 05:07:58 PM by Nickster206 »

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #2 on: May 03, 2020, 03:13:29 AM »
I have a new question! I'm struggling with understanding packages. When I launch th_dnh.exe, I want it to immediately run the package declared in th_dnh.def like package.script.main = x/y/z.dnh. Despite having declared the package as such in the .def file, the package does not launch automatically, and I am instead brought to the regular Danmakufu menu. I checked to make sure the path was correct, and the package works if I select it from the menu. What am I missing?

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #3 on: May 08, 2020, 08:16:37 PM »
Greetings! I am relatively new to Danmakufu, working my way through Sparen's tutorials, trying out my own stuff or to tinker with his provided code for learning's sake - long story short, for some reason the task TFinalize he provides only goes off in one of my scripts. I always call it in @Initialize, I have moved it into a function library outside of the pastebins below to ensure all my scripts make use of the same TFinalize task and, quite frankly, I am stumped. :( It does work in all my scripts when moved into @MainLoop, but then awards way too many points on spell capture for obvious reasons.

I've tried to search the old forum as well as Google for my issue before posting here, but have not found aught that could help me - doesn't mean it's not there, merely that I failed to find it.

https://pastebin.com/MucNFquT One of my scripts where TFinalize does not work.

https://pastebin.com/urXMyXZN My script where TFinalize does work.

Apologies if I missed out on anything else you might need!

EDIT: Please do notify me if I did. I... generally try to avoid getting help since most of the time, it's just me being stupid or my search engine fu being weak, so I'm far from used to making these posts...

EDIT 2: I am a fool thrice over and I have figured it out - I needed to yield; in @MainLoop... still leaving the post here in case anyone else stumbles over the same issue - my utmost apologies ;_;
« Last Edit: May 09, 2020, 02:30:05 PM by Icemoon »

WishMakers

  • Myouren's IT Guy
  • *
  • Ada.Text_IO.Put("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #4 on: May 09, 2020, 11:26:03 PM »
Quote
Despite having declared the package as such in the .def file, the package does not launch automatically, and I am instead brought to the regular Danmakufu menu. I checked to make sure the path was correct, and the package works if I select it from the menu. What am I missing?

Here's a good example of a def file, just in case you're still stuck.
Code: [Select]
window.title = <redacted>
package.script.main = Script/package.dnh
screen.width=640
screen.height=480
I'm sure you have everything like that, but make sure the name of the .def file is th_dnh.def and in the same folder as the exe.  Other than that, I'm not sure personally, but I don't work with .def files very often.
Do you have any more info about the issue?  What does your setup look like?
« Last Edit: May 10, 2020, 06:12:52 AM by WishMakers »
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #5 on: May 10, 2020, 04:58:54 PM »
Thank you so much for your reply! I tried messing around with the .def file after seeing your sample, and I figured out the problem!

I had declared package.script.main before window.title, and my window title had a "~" character in it. Even though the window would work with the ~ and launch to the regular danmakufu window, after removing it, it launched the package!

For further context, I am using your Woo version of Danmakufu, if that makes any difference in how the .exe interprets the .def. Either way, thank you for your help! It is greatly appreciated.  :D

Hyouiibara

  • The bittersweet teacher of life
  • Best quote: "Hm, something smells weak~"
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #6 on: May 19, 2020, 09:51:53 AM »
I'm new to danmakufu, and each time I tried to run the engine, it crashes and leaves a file called "Gcprojectcrash", I already used locale emulator and I downloaded the Ph3 version

I already posted it in Moriya shrine, but no one replied

Thank you for your reply!

Pichuun!  :power: :power: :power: :bigpower: :power: :power: :power:
Ran is hard, Yukari is lunatic. Keep kalm and rember ur hepi dei

WishMakers

  • Myouren's IT Guy
  • *
  • Ada.Text_IO.Put("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #7 on: May 21, 2020, 05:17:09 PM »
Quote
I'm new to danmakufu, and each time I tried to run the engine, it crashes and leaves a file called "Gcprojectcrash", I already used locale emulator and I downloaded the Ph3 version

Can you explain your problem in more detail?  What script were you trying to run, if any?  When and where does it crash?
For the record, for PH3 Locale Emulator shouldn't be necessary so if you turn that off I think you'll be fine.
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

Lapis Lazuli

    • 🌈Lapis Lazuli🌈#1508
  • Gender: Trans girl
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #8 on: May 22, 2020, 10:42:32 PM »
Hello friends!
So I've been following Sparen's Danmakufu ph3 tutorials for a while, but I've gotten stuck at the process of creating a plural. Whenever I create a plural and try to run it in Danmakufu, the game refuses to give me an error warning and simply crashes on the spot, even though I've created the simplest plural imaginable. But, still, here's the text file for it:

Code: [Select]
#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Vs. Momiji"]
#Text["For Kiiro"]

@Event
{

}
@Initialize
{
TPlural;
}
@MainLoop
{
yield;
}

task TPlural
{
    let dir = GetCurrentScriptDirectory();
    let obj = ObjEnemyBossScene_Create();
// ObjEnemyBossScene_Add(obj, 0, dir ~ "momiji 1.txt");
ObjEnemyBossScene_Add(obj, 0, dir ~ "momiji spell 1.txt");
ObjEnemyBossScene_LoadInThread(obj);
    ObjEnemyBossScene_Regist(obj);
    while(!Obj_IsDeleted(obj)){
        yield;
    }
    CloseScript(GetOwnScriptID());
}

Again, I get no error message, so I have no idea what could be going wrong. Can anyone give me a hand, please? Thank you so much.

EDIT: Figured it out! Turns out it has to do with how notepad++ saves .txt files.
« Last Edit: May 23, 2020, 02:54:36 PM by Lapis Lazuli »

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #9 on: May 24, 2020, 03:56:16 PM »
I've got some trouble working with Package scripts now. When I run all my singles, plurals, and the stage through the normal menu everything works as intended. However, when I launch the game through the package script, something strange happens.

Whenever I hit "Retry from Beginning" in my pause script which returns RESULT_RETRY, it keeps the game paused, and a new instance of the game opens up in the same window while the previous instance remains paused. At this point, there will be a paused instance of the stage and a running instance of the stage, and only the running instance detects key inputs. If I repeatedly select retry, more instances of the stage will open in the same way.

If I hit "Return to Title" for RESULT_END, the currently running instance of the stage will close because of TerminateStageScene(), and the most recent previous instance of the game will render and begin accepting key inputs. This will continue until all instances of the stage are closed, at which point, the package will close.

The code for my package script is below.

EDIT: I found out what the problem was. I was restarting the stage from the pause menu, meaning I couldn't finalize the stage scene. I moved the recursive TStageScene call to a point after calling FinalizeStageScene and now it works.

Code: [Select]
#TouhouDanmakufu[Package]
#Title["Touhou ~ Forlorn Souls of Wicked Past"]
#Text["-NL"]
#System["./system/Default_System.dnh"]
#Player["./player/player_reimu.dnh"]

@Initialize{
  TStageScene(GetCurrentScriptDirectory ~ "x1/stage1.dnh", GetCurrentScriptDirectory ~ "player/player_reimu.dnh", "");
}

@MainLoop{
  yield;
}

@Finalize{}

// STAGE SCENE                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task TStageScene(let stagePath, let playerPath, let replayPath){
  ClearCommonData;

  // Prepare the Stage Scene                    ------------------------------
  InitializeStageScene();

  // If a replay was called                     ------------------------------
  if(length(replayPath) > 0){
    SetStageReplayFile(replayPath);
  }

  let indexStage = 1;
SetStageIndex(indexStage);
SetStageMainScript(stagePath);
SetStagePlayerScript(playerPath);
StartStageScene();

  loop{
    // Hitting the pause key
if(GetVirtualKeyState(VK_PAUSE) == KEY_PUSH){
let resPause = RunPauseScene();
alternative(resPause)
case(RESULT_RETRY){
if(!IsReplay()){
TerminateStageScene();
TStageScene(stagePath, playerPath, replayPath);
          ClearCommonData;
}
}
case(RESULT_END){
TerminateStageScene();
        // ClosePackage();
}
}

let stgSceneState = GetStageSceneState();
if(stgSceneState == STAGE_STATE_FINISHED){

let stageResult = GetStageSceneResult();
alternative(stageResult)
case(STAGE_RESULT_CLEARED){
        TEndScene();
        break;
}
case(STAGE_RESULT_PLAYER_DOWN){
TEndScene();
break;
}
case(STAGE_RESULT_BREAK_OFF){
// TTitleScene();
        TEndScene();
        // ClosePackage();
break;
}
}

    yield;
  }
}

// PAUSE SCENE                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function RunPauseScene{
RenderSceneToTransitionTexture();
PauseStageScene(true);

let pathScript = GetCurrentScriptDirectory ~ "system/New_Pause.dnh";

let idScript = LoadScript(pathScript);
StartScript(idScript);

while(!IsCloseScript(idScript)){
yield;
}

PauseStageScene(false);

let res = GetScriptResult(idScript);
return res;
}

// END SCENE                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task TEndScene{
if(IsReplay){
// TTitleScene();
return;
}

FinalizeStageScene();

  while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}

let dirModule = GetModuleDirectory();
let pathScript = GetCurrentScriptDirectory ~ "system/New_EndScene.dnh";
let idScript = LoadScript(pathScript);
StartScript(idScript);

while(!IsCloseScript(idScript)){
yield;
}

let result = GetScriptResult(idScript);
alternative(result)
case(RESULT_SAVE_REPLAY){
TReplaySaveScene();
}
case(RESULT_END){
// TTitleScene();
    ClosePackage();
}
case(RESULT_RETRY){
TStageScene("","","");
}
}

// REPLAY SAVE SCENE                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task TReplaySaveScene{
let dirModule = GetModuleDirectory();
let pathScript = GetCurrentScriptDirectory ~ "system/New_ReplaySaveScene.dnh";

let idScript = LoadScript(pathScript);
StartScript(idScript);

while(!IsCloseScript(idScript)){
yield;
}

// TTitleScene();
  ClosePackage();
}

function RenderSceneToTransitionTexture{
let textureName = GetTransitionRenderTargetName();
RenderToTextureA1(textureName, 0, 100, true);
}
« Last Edit: May 29, 2020, 03:32:50 PM by Nickster206 »

Hyouiibara

  • The bittersweet teacher of life
  • Best quote: "Hm, something smells weak~"
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #10 on: May 26, 2020, 10:00:21 AM »
Can you explain your problem in more detail?  What script were you trying to run, if any?  When and where does it crash?
For the record, for PH3 Locale Emulator shouldn't be necessary so if you turn that off I think you'll be fine.
I tried to run the EXRumia script, I'm on Windows 10, and every time I tried to run the Danmakufu it just crashes and left an error BMP. File. Had a Segurazo virus once, note that
Ran is hard, Yukari is lunatic. Keep kalm and rember ur hepi dei

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #11 on: June 23, 2020, 09:00:02 AM »
Hello, been working on a coding a player for a while, I'm trying to figure out how to animate my character, which the tutorial I was using (Helepolis) didn't cover much, here's my code for rendering the player

https://pastebin.com/364tY5rd

For some reason, it doesn't seem to be animating, just staying on one static sprite based on the key presses. any ideas on why/ a better way to do it?


Tsukasa

  • Actually a white mage?
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #12 on: July 02, 2020, 11:34:45 PM »
Hello, been working on a coding a player for a while, I'm trying to figure out how to animate my character, which the tutorial I was using (Helepolis) didn't cover much, here's my code for rendering the player

https://pastebin.com/364tY5rd

For some reason, it doesn't seem to be animating, just staying on one static sprite based on the key presses. any ideas on why/ a better way to do it?

The way you have it now, every single frame, you're defining a new variable under those two names initialised to the value 0 -- you don't want that.

Instead, you want to define animFrame and animFrame2 outside of the while loop, not inside.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #13 on: July 04, 2020, 05:26:43 AM »
The way you have it now, every single frame, you're defining a new variable under those two names initialised to the value 0 -- you don't want that.

Instead, you want to define animFrame and animFrame2 outside of the while loop, not inside.
Ah, it seems that was what I have overlooked, thanks!

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #14 on: July 24, 2020, 05:42:34 PM »
Hi!
It's being a long time since I came here for the last time (I mean, it was still the old MotK forum...).

I have just a question... where is the danmakufu wiki with all the functions now? Last time I checked it it was here: http://dmf.shrinemaiden.org/wiki/Main_Page
But it's dead now. Please tell me all this usefull stuff is not lost for ever. Tell me that the danmakufu comunity is not dead.

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #15 on: July 25, 2020, 02:04:53 PM »
Hi!
It's being a long time since I came here for the last time (I mean, it was still the old MotK forum...).

I have just a question... where is the danmakufu wiki with all the functions now? Last time I checked it it was here: http://dmf.shrinemaiden.org/wiki/Main_Page
But it's dead now. Please tell me all this usefull stuff is not lost for ever. Tell me that the danmakufu comunity is not dead.

Wiki is down permanently as noted in one of the forum transfer threads. If it is resurrected, it will be in a different form.

If you need the function reference, the wiki is saved on the Wayback Machine and many parts have already been saved and backed up to websites (e.g. https://sparen.github.io/ph3tutorials/docs.html) and into various plugins for IDEs.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #16 on: July 25, 2020, 07:04:59 PM »
Thanks for the answer. That's not a good news for the wiki but I'm glad some people and The WaybackMachine saved the functions list.
I'm gonna work on a .doc to save this in one more place. This list is too precious to be lost.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #17 on: Yesterday at 12:51:47 PM »
Hello

Is there a way or a work around to add optional parameters with a default value in functions or tasks ?

Thanks