Author Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 468474 times)

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #630 on: June 13, 2017, 03:23:21 PM »
Ah, thanks for the help. I'd thought I needed to supply values to a function or something, but using the blend type makes it a lot easier.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #631 on: June 14, 2017, 04:30:30 PM »
I've run into a situation... I wanted to try and do a detailed background split up into three sections. I used 3d sprite objects split up by tiles roughly 3 to a section(so I can easily have it loop) and layers and create them all at the start, however looking at the object count  and the frame that I think is caused by it in the end I feel like I feel like I'm missing something... I'm using SetCameraPerspectiveClip to try and control how many things I render but is there some way to use 2dspritelist or something to combine the all the tile sections and still display them in 3d... or is there some other trick I'm missing, any help would be much appreciated.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #632 on: June 14, 2017, 05:04:45 PM »
I've run into a situation... I wanted to try and do a detailed background split up into three sections. I used 3d sprite objects split up by tiles roughly 3 to a section(so I can easily have it loop) and layers and create them all at the start, however looking at the object count  and the frame that I think is caused by it in the end I feel like I feel like I'm missing something... I'm using SetCameraPerspectiveClip to try and control how many things I render but is there some way to use 2dspritelist or something to combine the all the tile sections and still display them in 3d... or is there some other trick I'm missing, any help would be much appreciated.

If you can provide screenshots so that we can see what you are trying to do, we may be able to provide a better option. Additionally, please provide the code you currently have for reference.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #633 on: June 15, 2017, 01:13:53 AM »
Hello again! So I was wondering if it was possible to implement a life extend for every 2,000,000 points. I vaguely remember seeing a post about this before but I am not sure.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #634 on: June 15, 2017, 02:28:28 AM »
Hello again! So I was wondering if it was possible to implement a life extend for every 2,000,000 points. I vaguely remember seeing a post about this before but I am not sure.

It's possible. In your System script (or wherever you choose to keep track), set up a task to track score. If currscore > threshold, add extend and increase threshold by 2m.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #635 on: June 15, 2017, 07:39:41 PM »
It's possible. In your System script (or wherever you choose to keep track), set up a task to track score. If currscore > threshold, add extend and increase threshold by 2m.

Ah, okay thank you.

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #636 on: June 17, 2017, 08:03:21 AM »
I'm working on a script, and one of my spells seems to crash randomly when the spell ends, whether or not it's a capture. It's not replicable all the time, but I think it's caused by these two tasks.

https://pastebin.com/35vRnyVN
« Last Edit: July 04, 2017, 05:48:38 PM by Helepolis »
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #637 on: June 17, 2017, 11:39:05 AM »
Does the script stop crashing if you remove these? They seem pretty innocuous.

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

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #638 on: June 17, 2017, 01:15:42 PM »
Does the script stop crashing if you remove these? They seem pretty innocuous.

After some more testing, I managed to crash the script while the tasks were commented out. Here's the other tasks:

https://pastebin.com/X8qh9R0p
« Last Edit: July 04, 2017, 05:49:14 PM by Helepolis »
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #639 on: June 17, 2017, 01:59:39 PM »
After some more testing, I managed to crash the script while the tasks were commented out. Here's the other tasks:

To confirm, Danmakufu downright CRASHES - it does not freeze/etc.

Can you pastebin the entire thing for quick reference?

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #640 on: June 17, 2017, 02:44:59 PM »
To confirm, Danmakufu downright CRASHES - it does not freeze/etc.

Can you pastebin the entire thing for quick reference?

https://pastebin.com/680XWj08

Danmakufu first freezes, then brings up the 'not responding' window, then closes.
Again, the attack isn't always problematic; sometimes it ends perfectly fine, but every now and then it causes the problem.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #641 on: June 18, 2017, 05:27:43 AM »
https://pastebin.com/680XWj08

Danmakufu first freezes, then brings up the 'not responding' window, then closes.

That means it's technically not a crash - it's an infinite loop somewhere in your code, most likely.

The only thing I can think of us using break; instead of return; when checking enemy life, as break generally executes the rest of the stuff after the loop (including the other waits, etc. in your case).
I'll need to take a closer look at the code to be sure though.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #642 on: June 18, 2017, 06:26:06 AM »
Break statements will break out of the closest loop, switch, or function. A break in an if statement will break outside of it; in this case they're either functions or the loop is at the end of the function, so there is no problem. (You should use returns instead though)

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

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #643 on: June 18, 2017, 08:02:02 AM »
Thanks for the advice. Of course, since break and return served the same purpose here the freeze still occurs.
The freeze always happens after all the bullets turn into star items, and when the player is autocollecting them.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #644 on: June 18, 2017, 02:43:57 PM »
Thanks for the advice. Of course, since break and return served the same purpose here the freeze still occurs.
The freeze always happens after all the bullets turn into star items, and when the player is autocollecting them.

If this is the case, you're stating that the freeze happens AFTER the attack? Are you running this as a standalone Single, as part of a Plural, or as part of a Stage?

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #645 on: June 18, 2017, 02:48:12 PM »
If this is the case, you're stating that the freeze happens AFTER the attack? Are you running this as a standalone Single, as part of a Plural, or as part of a Stage?

Yes, the freeze happens after the attack, when run as a Single and as part of a Plural.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #646 on: June 19, 2017, 08:33:52 AM »
This is incredibly peculiar. I copied your script to run for myself, and after a bunch of testing and getting more and more precise (stupidly precise) with finding what crashes, I think I've found the root cause.

The core issue is that this appears to be a bug related to tasks, how they are managed internally, and breaking inside of tasks. The most barebones, fundamental example I can give is the following:

Code: [Select]
#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["test"]

@Initialize{
A;
}

task A{
loop(2){
B;
}
}

task B{
yield;
break;
}

@MainLoop{
yield;
}

@Event{
alternative(GetEventType())
case(EV_REQUEST_LIFE){
SetScriptResult(1);
}
}

This script should just instantly crash. Important pieces are that there are multiple instances of B running that were called from inside a loop, B yields, and then B breaks.
If it returns it's fine, if you just write B;B; it's fine, if there's no yield or otherwise if you space the B calls for longer than B takes to run it's fine. Generally the more instances there are the easier it is to crash, and mashing ctrl also seems to help it along.


This relates back to the actual problem script, I promise, I just dug really deep to get it this compact. The script executes this sort of behavior by running multiple instances of AmuletShoot, which each wait for a bit, and then break if the boss has 0 life, which is why it happens once the boss is defeated. If you remove the life condition and simply break, the script will crash most of the time. The reason why it seemed sporadic probably comes down to when each task started and when the boss died.

To be clear, if you replace your breaks here with returns, that should fix the problem.

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

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #647 on: June 19, 2017, 09:05:16 AM »
Thanks so much for taking all this time to fix my issue. I'll be using return in the place of break in the future.

It's certainly odd how tasks don't work properly when breaking, but since the workaround is fairly simple it's not a huge problem.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #648 on: June 19, 2017, 09:09:07 AM »
Yeah honestly it took me like 30 minutes to figure it was the break statements (mostly because I thought it was something else first), but then I spent several hours trying to refine what exactly the bug was and whether it was a bug at all lol

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #649 on: June 23, 2017, 12:28:33 PM »
Hi I'm trying to put BGM in my stage script using this function:

function StageBGM(obj, ID) {
    ObjSound_SetSoundDivision(obj, SOUND_BGM);
    ObjSound_SetRestartEnable(obj, true);
    ObjSound_SetLoopEnable(obj, true);
    ObjSound_SetLoopTime(obj, 0, 300);

    if(ID == 1){ObjSound_SetLoopTime(obj, 0, 96);}
    if(ID == 2){ObjSound_SetLoopTime(obj, 0, 58);}

    return obj;
}

But it won't play with ObjSound_Play(bgm,1). I've checked my directory paths to my sound files. And they're all correct.
I'm not receiving any error messages.

The only way I can add BGMs right now is with #BGM and that works fine.
But I need to use this function to switch my Boss Music.

Any help out there please?  ???

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #650 on: June 23, 2017, 07:55:58 PM »
Hi I'm trying to put BGM in my stage script using this function:

function StageBGM(obj, ID) {
    ObjSound_SetSoundDivision(obj, SOUND_BGM);
    ObjSound_SetRestartEnable(obj, true);
    ObjSound_SetLoopEnable(obj, true);
    ObjSound_SetLoopTime(obj, 0, 300);

    if(ID == 1){ObjSound_SetLoopTime(obj, 0, 96);}
    if(ID == 2){ObjSound_SetLoopTime(obj, 0, 58);}

    return obj;
}

But it won't play with ObjSound_Play(bgm,1). I've checked my directory paths to my sound files. And they're all correct.
I'm not receiving any error messages.

The only way I can add BGMs right now is with #BGM and that works fine.
But I need to use this function to switch my Boss Music.

Any help out there please?  ???

I assume you are using the code I provided in http://sparen.github.io/ph3tutorials/ph3u3l23.html#sub5

You stated that the paths are OK and it won't play. Firstly, did you create the actual sound objects themselves? You need to pass a valid Sound Object as a parameter to this function. Secondly, if the above doesn't work, please post the code where you call this function, as it will be necessary for us to see your code.

If there are any problems with my guide (which afaik has not been reviewed for accuracy, since I just found an error in the code I provided a few seconds ago), please inform me so that I can correct the errors.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #651 on: June 24, 2017, 01:02:54 AM »
Hi thanks for the reply,

Yes, I did create the actual sound object. This is the task where I called out the function.
It's in a script where I could test out this functon and switching between bgms.

task TStage {

    bgm2 = ObjSound_Create();
    ObjSound_Load(bgm2, bossMpath);
    StageBGM(bgm2, 2);

    bgm = ObjSound_Create();
    ObjSound_Load(bgm, BGMpath);
    StageBGM(bgm, 1);

    ObjSound_Play(bgm);
   loop(60*10) {yield;}
   ObjSound_Stop(bgm);
   ObjSound_Play(bgm2);
}

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #652 on: June 24, 2017, 02:39:09 AM »
PS.

Audio functions also don't work for some reason.

I tried loading the file path with LoadSound and PlayBGM but they don't work.

The only way I can add bgm right now is through the #BGM Header.

Should I try a format other than .ogg?

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #653 on: June 24, 2017, 04:08:23 AM »
Please actually show how your path is defined, both when not working and in your #BGM header. If you are using something like "./folder/track.ogg" as you would in the #BGM header, that is not entirely how you would do it in-script. Using backslashes \ is also valid only in the headers and will fail in-script. Everything you're describing is strongly indicative that your path is defined incorrectly.
« Last Edit: June 24, 2017, 04:21:26 AM by Drake »

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #654 on: June 24, 2017, 07:28:35 AM »
Ok here's how I do the path:

------------------------------------------------------------------
let dir = GetCurrentScriptDirectory();

let BGMpath = dir ~ "..libgmStageSong.ogg";
let bossMpath = dir ~ "..libgmBossSong.ogg";

----------------------------------------------------------------------
and here's the header

#BGM["./../../lib/bgm/StageSong.ogg"]

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #655 on: June 24, 2017, 07:45:08 AM »
So like I said, backslashes will not work. Besides this, the path you point to in #BGM is different from the others, as it goes up two parent directories.

Change to dir ~ "../../lib/bgm/StageSong.ogg" and it should work.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #656 on: June 24, 2017, 08:31:10 AM »
Ok. It works now.

Thank you so much.

I can't believe it was just a matter between forward and back slashes
 :D

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #657 on: June 24, 2017, 12:13:48 PM »
Phew. I thought I had screwed up somewhere in the tutorial's code.

Trung0246

  • Gaming, coding, drawing, composing, ... for fun
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #658 on: June 26, 2017, 09:56:12 PM »
Anyone know what are reimu, marisa, sanae, ... movement speed (in pixels) with and without hold shift across from touhou 10-12 and 13-16 ?

Edit: found the link http://thwiki.cc/%E6%B8%B8%E6%88%8F%E6%94%BB%E7%95%A5/STG%E6%9C%BA%E4%BD%93%E8%AF%B4%E6%98%8E
« Last Edit: June 27, 2017, 12:03:16 AM by Trung0246 »
My workbench & codedump
Gallery & album (WIP)

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #659 on: June 26, 2017, 11:06:54 PM »
Why does this code make the amulets go out from the boss and then ... straight down?
Code: [Select]
task TAmuletChain(dir)
{
loop(20)
{
let ex = ObjMove_GetX(objEnemy);
let ey = ObjMove_GetY(objEnemy);
let shotObj = CreateShotA1(ex, ey, 1, 270 + (85 * dir), 156, 10);
ObjMove_AddPatternA1(shotObj, 60, 2, GetAngleToPlayer(shotObj));
wait(5);
}
}

In case you're wondering, my intention is to have them go toward the player.