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

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1380 on: June 20, 2018, 03:25:19 PM »
I thought I was hallucinating at that error

The issue is that length is a reserved keyword in Danmakufu, and you are redefining it in the function. Replace all occurrences of your local variable length with something else.

Refer to https://sparen.github.io/ph3tutorials/ph3u1l5.html#sub9 for more info - I'll update the section as well

Ah, Thank you so much!

I totally forgot about that restriction. I'll be more careful regarding that possibility in the future. m(_ _)m



Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1381 on: June 20, 2018, 09:30:33 PM »

Hi, sorry if this showing as a reply is just that I'm new in posting stuff in websites like this one.
Is just that I've got a problem that has been bugging me for weeks, you see I'm VERY new at this.
The problem is that every time I'm trying to use this Sparen Style script that I copied while watching the How to make Circles and Ellipses video, plus by following the tutorials of the Danmakufu ph3 tutorial website, when I try it, it always give me the: "GetCenterX is not defined". error.???
https://pastebin.com/rmHmLv8s

And the same error is on many other codes for example:

Code: [Select]
task ParametricRing(){
  let angleT = 0;
    loop(30){
        CreateShotA1(ObjMove_GetX(objBoss) + 90*cos(angleT), ObjMove_GetY(objBoss) + 90*sin(angleT), 2, angleT, 1, 0);
        angleT += 360/30;
    }

Preventing me from knowing if the codes I'm making have a failure or not.

Can somebody help me please :ohdear:

And I don't wanna bother but can somebody give me a curve laser code as well and tell me why the BGM that I put is not working please.  :(


« Last Edit: June 21, 2018, 09:16:57 PM by DarkHydra »

JDude :3

  • tururu
  • boy with code
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1382 on: June 20, 2018, 11:28:13 PM »
Where can I find a collection of the "dot" bosses sprites?
Or a link with all of them?
"dnh is hard" - said no one
"dnh is bullshit" - everyone making a creative pattern

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1383 on: June 21, 2018, 12:34:35 AM »
Where can I find a collection of the "dot" bosses sprites?
Or a link with all of them?

Are you referring to https://www.shrinemaiden.org/forum/index.php/topic,18433.0.html ?

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1384 on: June 21, 2018, 02:40:19 AM »
"dot" is just a term for pixel art.

You might also be referring to KMAP's stuff, which are linked on the Japanese DNH wiki here under 敵画像:
http://danmakufu.wiki.fc2.com/wiki/素材リンク

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

JDude :3

  • tururu
  • boy with code
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1385 on: June 21, 2018, 11:54:29 PM »
"dot" is just a term for pixel art.

You might also be referring to KMAP's stuff, which are linked on the Japanese DNH wiki here under 敵画像:
http://danmakufu.wiki.fc2.com/wiki/素材リンク
The main link server is down....
http://coolier.dip.jp:8080/th_up3/file/th3_4065.lzh
"dnh is hard" - said no one
"dnh is bullshit" - everyone making a creative pattern

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1386 on: June 22, 2018, 04:37:20 AM »
Oh. It's just the 8080 port that doesn't work.
http://coolier.dip.jp/th_up3/file/th3_4065.lzh

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1387 on: June 24, 2018, 06:39:53 PM »
How do I make bullets ricochet off of walls only once?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1388 on: June 24, 2018, 07:39:26 PM »
How do I make bullets ricochet off of walls only once?

Assuming you've already watched the wall bouncing video tutorial, all you need to make them bounce exactly once is have a task that first waits for the bullet to hit a wall, and then performs the bounce. The task terminates then, and no more bouncing is performed.

Otherwise, refer to the tutorial at https://www.youtube.com/watch?v=eoOlDcWmGjc
Warning: Old tutorial, may contain cringe

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1389 on: June 24, 2018, 10:14:50 PM »
Assuming you've already watched the wall bouncing video tutorial, all you need to make them bounce exactly once is have a task that first waits for the bullet to hit a wall, and then performs the bounce. The task terminates then, and no more bouncing is performed.

Otherwise, refer to the tutorial at https://www.youtube.com/watch?v=eoOlDcWmGjc
Warning: Old tutorial, may contain cringe

Well. I should've mentioned I use 0.12. Sorry. But, nice tutorial though.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1390 on: June 24, 2018, 10:39:42 PM »
The logic and structure is the same, you just have to translate which function does what.

You really should just learn ph3 though. You're using a program that's been deprecated for many years.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1391 on: June 24, 2018, 11:48:02 PM »
The logic and structure is the same, you just have to translate which function does what.

You really should just learn ph3 though. You're using a program that's been deprecated for many years.

I'm getting there.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1392 on: June 27, 2018, 01:59:05 AM »
I'm working on an Utusho Script and I'm trying to replicate the waves from Stage 5 from SA. I'm not entirely sure how to make the textures wavy. I was looking into Blargel's Utushu script but it's 0.12m and I didn't understand much of it  :ohdear:. But if anyone could show an example on how to do it, it would be great!

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1393 on: June 27, 2018, 02:58:05 AM »
You should use shaders to accomplish this; I would not recommend looking to Blargel's old script for that. Somebody might have already done this before, but if not you might be out of luck unless you really want to dig into HLSL and program that yourself.

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1394 on: June 27, 2018, 07:01:05 PM »
I'm currently doing a project in Danmakufu that involves writing to and then reading from file. However, opening the file always fails and I'd like to know why.

First, the code that creates the file:

Code: [Select]
    let outputfile = ObjFile_Create(OBJ_FILE_TEXT);
    let outputfilepath = OUTPUT_DIRECTORY ~ "apmfps-" ~ starttime ~ ".csv";
    ObjFile_OpenNW(outputfile, outputfilepath);
    ...
    // Flush to file
    ObjFileT_AddLine(outputfile, csvlog);
    ObjFile_Store(outputfile);
    WriteLog("APM_StartFPS: Wrote CSV to " ~ outputfilepath);
    Obj_Delete(outputfile);
    // yield once before marking as complete
    yield;
    finished_fps = true;
    WriteLog("APM_StartFPSDEBUG: Finished");

In another function, I wait for this task to finish before proceeding:
Code: [Select]
while (!finished_fps) {yield;} //Wait for file to be written before reading
ObjFileT_AddLine(outputfile, APM_ChartGenFPS);

This is a separate File Object that I am writing to.

APM_ChartGenFPS is implemented as follows:
Code: [Select]
function APM_ChartGenFPS {
    WriteLog("APM_ChartGenFPS: Starting.");
    let svg = SVGChartGen;
    let paths = [];
    let maxfps = 0;
    let filepath = OUTPUT_DIRECTORY ~ "apmfps-" ~ starttime ~ ".csv"; // Current run
    //filepath = OUTPUT_DIRECTORY ~ "apmfps-20180627142126.csv"; //debug
    let datapoints = CSVtoArray(filepath);
    maxfps = maxarr(datapoints);
    WriteLog("APM_ChartGenFPS Debug: Maximum FPS is " ~ ToString(maxfps));
    ...
}

Note that filepath is EXACTLY the same as the output file path from before.

In CSVtoArray, the following is done:
Code: [Select]
function CSVtoArray(filepath) {
    WriteLog("CSVtoArray: Running on " ~ filepath);
    let handle = ObjFile_Create(OBJ_FILE_TEXT);
    let status = ObjFile_Open(handle, filepath);
    while (!status) {
        //WriteLog("CSVtoArray: Reading file " ~ filepath ~ " failed.");
        status = ObjFile_Open(handle, filepath);
        yield;
    }
    WriteLog("CSVtoArray: Successfully read file " ~ filepath ~ ".");

    let toreturn = [];
    ascent(i in 0..ObjFileT_GetLineCount(handle)) { // For every line
        let line = ObjFileT_GetLineText(handle, i + 1); // Recall that lines are 1-indexed
        let split = SplitString(line, ",");
        ascent(j in 0..length(split)) {
            toreturn = toreturn ~ TrimString(split[j]);
        }
    }
    Obj_Delete(handle);
    return toreturn;
}
The code, when run, never gets past the infinite while loop - status is never set to true, the Success message never prints. Even after the file has shown up in my computer and I can open it, ObjFile_Open continues to fail.

Code: [Select]
APM_StartFPS: Wrote CSV to Z:/Users/andrewfan/Desktop/THDNH ph3pre6a/script/ Sparen DNH APM/test/./dnhapm-output/apmfps-20180627144737.csv
2018/06/27 14:47:40.765 APM_StartFPSDEBUG: Finished
2018/06/27 14:47:40.775 APM_ChartGenFPS: Starting.
2018/06/27 14:47:40.787 CSVtoArray: Running on Z:/Users/andrewfan/Desktop/THDNH ph3pre6a/script/ Sparen DNH APM/test/./dnhapm-output/apmfps-20180627144737.csv
2018/06/27 14:47:42.648 force terminate
As you can see in the above, it's *writing* properly, and CSVtoArray is running on the same file path as the file that was written. However, ObjFile_Open fails continuously in the while loop. I can confirm that the file exists locally. And if I hardcode the filepath, ObjFile_Open actually works (see the debug statement in APM_ChartGenFPS).

So my question(s) are:
- Is ObjFile_Store() blocking, as in, if you call it, will the next line of code not execute until the file has been written? (Confirmed blocking)
- Is ObjFile_Open() blocking? (Confirmed blocking)
- Does ObjFile_Open() only know about files that existed when the script was first run, or does it have access to the current files as of function call? If the former is true, is there a way to notify Danmakufu about the current files?
- Are there any standard ASCIIcharacters that cannot be placed in filenames in Danmakufu (spaces, hyphens, /, \)?
- Am I crazy? Is this Danmakufu being weird? Is it a stupid oversight?

Thanks.
« Last Edit: June 27, 2018, 11:06:53 PM by Sparen »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1395 on: June 27, 2018, 10:06:44 PM »
This minimal example:

Code: [Select]
let file = ObjFile_Create(OBJ_FILE_TEXT);
let path = GetCurrentScriptDirectory() ~ "aaa.txt";
ObjFile_OpenNW(file, path);
ObjFileT_AddLine(file, "aaaaaa");
ObjFile_Store(file);
Obj_Delete(file);
yield;
file = ObjFile_Create(OBJ_FILE_TEXT);
let status = ObjFile_Open(file, path);

Works just fine.

ObjFile_Open, ObjFile_Store, and ObjFileT_AddLine are all blocking (as they should be), easily confirmed by reading/writing large files.
« Last Edit: June 27, 2018, 10:15:56 PM by Drake »

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1396 on: June 27, 2018, 11:05:49 PM »
Full source available at https://github.com/Sparen/Sparen-DNH-APM/blob/master/SparenDNHAPM.dnh

I spent so much time trying to fix this that I'm almost certain the bug lies elsewhere, but I can't be sure.

R. P. Genocraft

  • Craftsman of absolute unpredictability
  • Boundary of productive and lazy
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1397 on: June 28, 2018, 12:58:15 PM »
Is it possible to make a small square in which everything is rotated 180 degrees? Like Seija's spells, but only a fraction of the screen.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1398 on: June 28, 2018, 12:59:37 PM »
Is it possible to make a small square in which everything is rotated 180 degrees? Like Seija's spells, but only a fraction of the screen.

You can snap a render target of the screen, set the source and dest rects of a primitive object/2D Sprite to use the square, and then use ObjRender_SetScale to flip the x or y axes.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1399 on: June 28, 2018, 01:31:31 PM »
This minimal example:

Code: [Select]
let file = ObjFile_Create(OBJ_FILE_TEXT);
let path = GetCurrentScriptDirectory() ~ "aaa.txt";
ObjFile_OpenNW(file, path);
ObjFileT_AddLine(file, "aaaaaa");
ObjFile_Store(file);
Obj_Delete(file);
yield;
file = ObjFile_Create(OBJ_FILE_TEXT);
let status = ObjFile_Open(file, path);

I did this but with a
Code: [Select]
    if (!status) {
        RaiseError("file not found");
    }
The error was raised.

The thing is that Fluffy8x's iDNH writes to file and then *executes that file as a script* and it works perfectly. However, just opening a file seems to go wrong.

I believe that Koishitale did this and it worked perfectly fine, but I'll give it a quick test and see what the problem is.

Edit: This problem seems to be completely independent of the directory, filename, or file extension. It may have to do with the fact that I'm running this under Wine but Koishitale seems to open and read text files fine (though it only opens, or only reads - not both in the same play through)

Edit 2: I ran GetFilePathList after creating the file and deleting the object but before getting the status via opening the file. The file is definitely there - it's just that ObjFile_Open says it isn't.

I'm going to assume that this is a Wine issue rather than a Danmakufu issue, since it seems that I'm the only one encountering it. I'll find a suitable workaround.

Edit 3: Confirming that when using Wine, ObjFile_Store is not blocking. Changing yield; to loop(180) {yield;} fixes the problem.
To clarify, one yield; between Obj_Delete(file); and file = ObjFile_Create(OBJ_FILE_TEXT); results in the file not being found, while more than one yield allows the file to be accessed without a problem.

Edit 4: Above extra yield; only works if the file is being opened in a task? If I change it to a function, it fails 100% of the time, regardless of how long I wait. KoishiTale seems to use tasks, but iDNH uses a function when creating a new file (to block before next function is run).

Final? Edit: I'm crazy; changing my report generator from a function to a task seems to have done the trick. Sorry for the confusion.
« Last Edit: June 28, 2018, 02:31:47 PM by Sparen »

R. P. Genocraft

  • Craftsman of absolute unpredictability
  • Boundary of productive and lazy
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1400 on: June 28, 2018, 01:52:58 PM »
You can snap a render target of the screen,
What do you mean by that?

JDude :3

  • tururu
  • boy with code
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1401 on: June 30, 2018, 12:31:53 AM »
I know it sound a little dumb, but, I can't figure it out what is idle and moving animation...
If you can, please enumered it or tell me the order... :blush: :blush:
"dnh is hard" - said no one
"dnh is bullshit" - everyone making a creative pattern

Gregory

  • I draw stuffs
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1402 on: June 30, 2018, 12:37:54 AM »
I know it sound a little dumb, but, I can't figure it out what is idle and moving animation...
If you can, please enumered it or tell me the order... :blush: :blush:

this sheet used the column animation. So if I read it correctly, it would be

https://imgur.com/a/lFWRBXR

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1403 on: June 30, 2018, 01:02:17 AM »
What do you mean by that?

You can use RenderToTextureA1(targetname, start, end, rendertargetclear) to save a render target.

That render target can be used as the texture for a Primitive Object such as a 2D Sprite. You can choose which part of the texture to use with source/dest rects.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1404 on: July 01, 2018, 02:00:12 AM »
Greetings again,

I'm kind of at my wits end since it took me this long to figure out how to use parameters (and eventually figured it out after a long time struggling), but now I face a new challenge. Remember "rendernightmare"? Well now it's renamed "renderplayer2(angle)" with the same content as render nightmare, but with added stuff such as the parameters.

Link 1 : https://ibb.co/deLp6d
opdup is the thing that you gave me to try to duplicate the options by 9, but it doesn't seem to work as planned, but at least it didn't give me errors.

link 2:https://ibb.co/jaGJzy
Just for more context, I had to declare an angle variable in line 21 since Danmakufu kept nagging me that "angle" was not defined. Since I did it was asked, it ran. However, it's didn't give me the desired result and it seems that it didn't do anything at all but give me just one option.

Before you tell me to look at tutorials, I came here because I looked at the tutorials, tried everything, and I couldn't come up with a solution. Can you please solve this conundrum?

Thank you so much if you do reply to this.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1405 on: July 01, 2018, 02:52:05 AM »
The problem seems to be that you're calling renderplayer2 nine times in an ascent loop, but without actually using i, which is the whole point of the ascent loop. You're just calling the function with 9/360 as the angle nine times. If you changed it to use i*num_options/360 instead of num_options/360, you should end up with a circle of evenly spaced options.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1406 on: July 01, 2018, 03:10:12 AM »
The problem seems to be that you're calling renderplayer2 nine times in an ascent loop, but without actually using i, which is the whole point of the ascent loop. You're just calling the function with 9/360 as the angle nine times. If you changed it to use i*num_options/360 instead of num_options/360, you should end up with a circle of evenly spaced options.

Even though I DID add the i as instructed, it doesnt seem to do anything

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1407 on: July 01, 2018, 03:38:52 AM »
Also I did switch things around and still nothing

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1408 on: July 01, 2018, 04:02:13 AM »
Greetings again,

I'm kind of at my wits end since it took me this long to figure out how to use parameters (and eventually figured it out after a long time struggling), but now I face a new challenge. Remember "rendernightmare"? Well now it's renamed "renderplayer2(angle)" with the same content as render nightmare, but with added stuff such as the parameters.

Link 1 : https://ibb.co/deLp6d
opdup is the thing that you gave me to try to duplicate the options by 9, but it doesn't seem to work as planned, but at least it didn't give me errors.

link 2:https://ibb.co/jaGJzy
Just for more context, I had to declare an angle variable in line 21 since Danmakufu kept nagging me that "angle" was not defined. Since I did it was asked, it ran. However, it's didn't give me the desired result and it seems that it didn't do anything at all but give me just one option.

Before you tell me to look at tutorials, I came here because I looked at the tutorials, tried everything, and I couldn't come up with a solution. Can you please solve this conundrum?

Thank you so much if you do reply to this.

Please provide a Minimal, Complete, and Verifiable Example. As it stands, we don't have enough context to figure out what else you have done, and you haven't explained what your *intended* result is.

Are the two code blocks part of the same script? Are they related?

Now, for specifics:
Part 1: Assuming you want the 9 options to be evenly spaced, use i * 360/9 in the ascent loop. This is because you have 360 degrees in a circle, and you have nine options, so you divide 360 degrees by 9, and multiply by i to get the angle for each familiar.

Part 2: angle is the parameter to the function. Give it the angle that it wants. Unless of course you meant to call opdup instead of renderPlayer2 in your second example.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1409 on: July 01, 2018, 06:04:02 AM »
In renderPlayer2 you're manipulating playerObj2. Even if you run renderPlayer2 nine times, it's still just only working with the one object, and you show in the second screenshot it's only one object. You probably want to be working with nine different objects...

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