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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #510 on: March 16, 2017, 06:34:10 PM »
@Helepolis

I tried to do sound system as u said, but it was way too complicated for me. Could u tell me please how it works more detailed. And how can I put these variables into a AreaCommonData???

Edit: Nevermind, i solved the problem :/
Sorry for being unable to respond on time. Lately been quite busy that I even neglected my own game development.

Curious though, what was the final problem and how did you solve it?

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #511 on: March 17, 2017, 06:24:05 AM »
Oh, I see. I understand. Thank you for responding!

Curious though, what was the final problem and how did you solve it?

The problem was in restarting the music after I leave the pause. Music started always from beginning. My mistake was:
Code: [Select]
ObjSound_SetRestartEnable( GetAreaCommonData("sound", "song", 0) ,false) Which is of course wrong, because this common data not a music object itself. The solution was to call this function as I did it with play/stop music object.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #512 on: March 20, 2017, 05:12:55 PM »
Just to preface this post, I'd like to note that Danmakufu has been my only programming experience. I've had no formal education or experience in any general programming language.

I've been looking for something that I can eventually move to after I'm done with Danmakufu and to this end I've recently been dabbling in a Lua framework called LOVE2D, which has had me learning coding in Lua. It's been stated in the past that Danmakufu's tasks are basically the same as coroutines and it's my dabbling in lua that made me understand exactly why that is correct.

Danmakufu's tasks are not truly running in parallel. This is why the @MainLoop must be yielded in order for tasks to properly run (it's essentially resuming the task coroutine from where it was paused, or yielded, if I'm correct). I understand this now and have started to construct a similar method of programming in lua using coroutines to the tasks that I'm used to using in Danmakufu.

What I don't understand is how Danmakufu runs multiple scripts at the same time. I don't even really get what the scripts even ARE, as each one of them appears to be its own separate thread since they each have their own @MainLoop and tasks. It's been stated before that Danmakufu cannot do multithreading so these scripts can't actually be their own processing threads, unless I'm misunderstanding something.

So, my question is:

How does Danmakufu handle scripts if multiple can be run at the same time?

I'm interested in learning so that I can hopefully construct a programming environment that is similar to Danmakufu, which is what I'm used to. I'm still learning so please correct me if anything I said in this post is incorrect.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #513 on: March 20, 2017, 08:53:07 PM »
When it comes to threading, I can tell you my own experience from being a JAVa programmer. Threading in Java is never parallel. The word multi-threading implies parallel execution, but it is not. For the Java programming language, the Java Virtual Machine (Also called JVM) handles the order of execution for any multi-threaded program made in Java.

Example, heavily assume that I launch a java program which creates 3 threads and each thread has a loop which inside simply echoes "Hello I am thread N".

Next, I start the threads in order 1, 2 and 3. Here comes the fun part: The order of these echoes are unsure. I didn't write "never" because that is a false statement. When it comes to threading, all you can claim is that the Threads are started, running and doing their jobs.
"Hello I am thread 1"
"Hello I am thread 2"
"Hello I am thread 1"
"Hello I am thread 3"
"Hello I am thread 3"
"Hello I am thread 1"
"Hello I am thread 3"


The above could be an outcome. Some thread might be even reported four times in a row or perhaps never for a long time. You simply don't know. There is absolutely no guarantee that the threads are echoed in order. So is there a way to control order in Java? Yes, there is. But that requires in-depth knowledge of the Java language. Are other languages similar when it comes to threading. I assume they are, but can't confirm from experience.

So why the example, you might ask. Danmakufu is (guessing) similar. The MainLoop of a script is always initiated by the engine. It can be assumed that the MainLoop in your script isn't actual the Main Loop. No, the Danmakufu engine probably has its own actual MainLoop hard coded which you cannot influence or control. Therefore the script @MainLoop is definitely a thread on its own. Which seems to have highest ultimate priority when not yielded, regardless of any task added in your script. Something that isn't true in Java. Threads in Java can be given a priority, but again there is no guarantee whether it gets a chance to run.

We already know that if you yield; the @MainLoop in your script, the Danmakufu Engine's Main Thread checks whether there are other tasks that can be performed. But it will never stop executing the @MainLoop. The @MainLoop of your script always runs, until it hits that yield. Only then the Engine will allow other threads to "grab their chance" and execute. All of this happens so fast that we humans thing there is parallel process going on. But there isn't.

Experiment
I heavily assume that if you would immediately call 3 bullets tasks with 3 different colours at the same time, the order of the bullet would be different each time the MainLoop hits that yield. So for example:
Code: [Select]
task fireRed() { }
task fireBlue() { }
task fireGreen() { }
The last bullet fired would overlap the previous two (because of Drawing Order). And my bet is that each time the overlapping bullet is a different colour.


Edit:
Asked a C# programmer RL friend about multi-threading. He says that in C# it is the same case as Java when it comes to the order of threads running. Except C# threading is probably influenced directly by the OS / CPU's orchestration. Fun fact, the JVM is actually also influenced by the OS/CPU.

Edit2
Tested the experiment of firing three bullets. It seems that there order of execution for tasks is as displayed in the script. Which, is if I think about it, quite logical. Calling the bullets is either done by a "task" or the @MainLoop. And there is one guarantee when it comes to putting things in loops (threads). The stuff is executed from top to bottom inside it. So my experiment failed because the script itself is probably a single thread. I have no idea how to run three scripts simultaneously.

Edit3:
Wow,  I forgot to answer your question after building up this much of a wall of text. I can only guess the following:

The Danmakufu Engine launches a new thread for every new script started. When you have a Stage Script and a Spell Card script, they are both independent instances, but the Engine's main thread is aware. Each script also launches its own routine called the @MainLoop, which has highest priority unless yielded within the script.

Scripts themselves don't conflict over each other's @MainLoop, that is for sure. But the execution of which script's MainLoop is most likely controlled by the Engine's main thread.

« Last Edit: March 20, 2017, 09:37:20 PM by Helepolis »

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #514 on: March 21, 2017, 04:09:09 AM »
Thanks Helepolis, that was a very insightful read and makes a lot of sense. I think you're definitely right about multithreading not having perfectly simultaneous processes.

I have no idea how to run three scripts simultaneously.
You can actually use LoadScript and StartScript to start any number of scripts. I actually do this to start special scripts for effect rendering and sound management in my game. They listen for Event signals from other scripts to perform visual effects like concentrations and explosions and play sound effects without worrying about being interrupted by the ending of a single script.

Edit3:
Wow,  I forgot to answer your question after building up this much of a wall of text. I can only guess the following:

The Danmakufu Engine launches a new thread for every new script started. When you have a Stage Script and a Spell Card script, they are both independent instances, but the Engine's main thread is aware. Each script also launches its own routine called the @MainLoop, which has highest priority unless yielded within the script.

Scripts themselves don't conflict over each other's @MainLoop, that is for sure. But the execution of which script's MainLoop is most likely controlled by the Engine's main thread.
My guess was that each new script was actually a task of sorts running from the hidden 'true' MainLoop. The hidden MainLoop would yield to the new script's MainLoop which would then in turn yield to any running tasks in that script. This begs the question of whether I can have coroutines start other coroutines which is something I had not considered.

Are we sure that scripts are definitely separate processing threads and not like tasks? I had imagined that if that were the case, then each script would be able to take advantage of a different core of a multi-core CPU, but my understanding on that is very limited and I'm probably wrong about it. I was under the impression that because Danmakufu only ever uses one CPU core it isn't truely utilizing multithreading, at least in that sense. I'm probably babbling about nonsense that I don't fully understand. Someone please clarify, if that is the case.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #515 on: March 21, 2017, 05:49:47 AM »
Within a script, there are the predefined routines like @Initialize, @MainLoop, etc. These are predefined because they have special behaviour relating to that running script that is hardcoded as part of the engine. The actual execution flow of a "script" will start by doing some internal initialization stuff, interpreting and running @Initialize and @Loading, then when done will run @MainLoop once per frame, and also once per frame internally checking if conditions to run @Finalize are met. A global event scheduler (I'm assuming it's global) likely also takes the whole stack of events being triggered and messages the event data to the relevant scripts, and on that frame, that script's @Event will be run once for every new event put in that script's event stack. (That or there's another mechanism for scripts to add events to all other scripts' event stacks somehow. Or, all events are done together outside of the individual script flow, but I doubt that.)

If the programmer starts a task in @Initialize, which is likely, that starts a coroutine. Once it yields or ends, the context switches back to where the task was called; in @Initialize, which again is part of the main execution flow of the "script". If the task started more tasks the same applies and it just builds a tree of new coroutines and eventually winds back to the initial context. The "tree"-ness of calling tasks from tasks only really matters when they're first called; once a task yields, that coroutine is just set up in a queue for the next frame. Once @Initialize is over, and I assume it's starting on the next frame, @MainLoop runs. @MainLoop will have some stuff in it, and importantly it (should) yield, which lets the context yield back to the first task queued in the task scheduler. Once that task yields (or ends) again, context switches to the next in the queue, and so on until it reaches the end of the queued tasks for that frame, and finally context comes back to @MainLoop, which maybe runs some more stuff and then ends.

If you're clever, you might notice that if you don't put a yield in your @MainLoop, you get a few interesting pieces of information: 1) @MainLoop does not halt, and will keep running once per frame; and 2) only the coroutines relevant to the script are never yielded back to. Because of this it can be concluded that task/coroutine scheduling is divided on the script-level and is not a global scheduler. Tasks "belong" to a script.

Now, I've been writing "script" in quotations here because as far as I can tell, scripts are structures that have similar organization to coroutines, but are one step up the chain, and ultimately do many more things. I'm fairly sure that Danmakufu doesn't particularly do any multithreading with this, and that scripts are simply run in order similarly to how coroutines are scheduled per task, but done in a more global fashion. Danmakufu does run more than one thread for running in general though.

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #516 on: March 21, 2017, 08:07:08 PM »
All I can suspect from the LogWindow is that the Danmakufu Engine is scheduling its own coroutines/threads. (See attachment). The extra tasks/threads appeared when I was transitioning between Dnh's own Main Menu and Package Menu.

Looking at the ETaskManager at the top, is this perhaps the global "Manager" which handles all the coroutines for the engine?

Spacechurro

  • FiteMe;
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #517 on: March 25, 2017, 04:13:18 AM »
Hello, Just a quick question, that's probably a lot simpler than I think it is, but here it is:
So I've been trying to make my own Library for the typical touhou dialogue between characters (And hopefully branch off from there)
I've tried to make a task for the text like one would make a bullet object, that kind of seems to work, almost. The text shows up and everything, but I'm having a problem with how I move dialogue along, using the shoot button. I'm trying to do it in mainloop of the single I want it to appear in itself, but I can't seem to tell it to delete itself after the variable "ef" is upped a number (Or after the next text appears), eventually lagging the game after holding down the shoot button, especially since I'm not sure how to delete the text object outside it's task, and I can't assign them variables since they're not objects.

--I deleted the code to not take up so much room--

Hope someone can help, I'm not an expert at coding, so I hope that I don't look like a fool right now, heh.

P.S. Does this look too advanced for me, or is it not as advanced as it seems?

EDIT:

I was able to fix my problem by letting the TextOut task be an individual function inside the script itself, makes it less flexible or reusable, but it works!
« Last Edit: March 27, 2017, 12:04:15 AM by Spacechurro »
task FiteMe{
    loop{
          let m = atan2(MyFistY-YourFaceY,MyFistX-YourFaceX);
          Punch01(GetMyX,GetMyY,100,m,REDFIST01,0);
          wait(1);  }     }

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #518 on: March 28, 2017, 12:04:49 PM »
Hello, I've been following Sparen's (written) danmakufu tutorial, and I've run into an issue.
When I try to save a replay, I get an error: "replay information not found"
Am I missing something obvious?
I can post links to my code, if necessary

P.S I am using a custom package

EDIT: Code Removed, problem is solved
« Last Edit: March 28, 2017, 02:53:11 PM by Asthmagician »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #519 on: March 28, 2017, 01:12:47 PM »
If this is in regards to the Replay Save File Guide, be aware that it hasn't been reviewed, so there may be issues with it that I have not yet found.

Otherwise, please provide code and the screenshot of the error. That will assist in the debugging process and if there's incorrect information in the tutorial, it will help in correcting that incorrect information.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #520 on: March 28, 2017, 02:33:58 PM »
I forgot to mention, I'm using a custom package so I may be missing something there
I updated my post with pastebin links.

UPDATE: I am a dumb  :blush:
I forgot to add FinalizeStageScene in package script.
I added it, now it works.

P.S the danmakufu tutorials (especially the replay guide) are very helpful, thank you for writing them.
« Last Edit: March 28, 2017, 03:05:25 PM by Asthmagician »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #521 on: April 05, 2017, 03:51:50 PM »
Could somebody help me please to understand this function
Code: [Select]
ObjSound_SetLoopSampleCount What means one sample count, and how can I measure it?

Many thanks in advance!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #522 on: April 05, 2017, 05:09:41 PM »
Could somebody help me please to understand this function
Code: [Select]
ObjSound_SetLoopSampleCount What means one sample count, and how can I measure it?

Many thanks in advance!
Sample count you can measure using for example Audacity. See this screenshot:



Press on the arrow button as shown to open the various timings. Select samples and you'll notice that the values have changed. Next, you can use those values to loop through specific section of your BGM. It is much much more accurate than for example seconds (unless using milliseconds). So this would result in the following usage:
Code: [Select]
ObjSound_SetLoopSampleCount(<object>, 647932, 1479241);
« Last Edit: April 05, 2017, 05:11:53 PM by Helepolis »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #523 on: April 07, 2017, 05:31:31 PM »
Sorry for being annoying with many questions. I'm sure I wont ask long time after solving this problem.
I have 2 stage-tasks in [Package] script. One for a normal stage. And second for a Spellcard Practice. The problem is in replaying them. Sometimes script can't find the path to a replay. Or even replay of the first stage will play on the second stage. How do I tell to a replay to play a right stage?

Solved.

I have a general question. I don't know if that fit to this topic, but how do I record and edit danmakufu videos in a best quality. Which videorecorders/editors do you normally use?
« Last Edit: April 09, 2017, 11:53:56 PM by Zhan_fox »

Spacechurro

  • FiteMe;
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #524 on: April 11, 2017, 12:26:32 AM »
Lightworks is a nice "free" video editor (Quotes on free cause it's a trial version, but there's no time limit, and you can still export and save videos, they're just not as quality as one would want), other than that all I use is windows movie maker (Booing in the distance)
task FiteMe{
    loop{
          let m = atan2(MyFistY-YourFaceY,MyFistX-YourFaceX);
          Punch01(GetMyX,GetMyY,100,m,REDFIST01,0);
          wait(1);  }     }

Spacechurro

  • FiteMe;
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #525 on: April 14, 2017, 08:13:07 PM »
I have a small question,

What is the name for the item that appears and hones hen a boss shot is deleted? I want to make it play a sound effect when the player collects it. Like how there is "ITEM_POINT" or "ITEM_SPELL", is there one for the deleted shots?
task FiteMe{
    loop{
          let m = atan2(MyFistY-YourFaceY,MyFistX-YourFaceX);
          Punch01(GetMyX,GetMyY,100,m,REDFIST01,0);
          wait(1);  }     }

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #526 on: April 15, 2017, 04:12:51 AM »
As far as I can tell you can't. The constants for different default items like ITEM_POWER just hold integers (item ids) ranging from -65536 to -66629. Maybe you would guess the star item is like these and just undocumented, but trying to spawn items -65537 or -65528 crashes DNH. What's an even bigger indicator of uselessness is that collecting the star items doesn't even trigger the EV_GET_ITEM event (or any player event at all), meaning it isn't even handled like an item by the engine and you wouldn't be able to trigger sounds even if there was a usable id.

The intention really is to create an item script yourself (in order to handle things like item collecting and generating) and to disable the default star item (with SetDefaultBonusItemEnable(false)).
In fact the example in the official documentation is exactly that.
« Last Edit: April 15, 2017, 04:16:26 AM by Drake »

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

Spacechurro

  • FiteMe;
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #527 on: April 19, 2017, 02:03:31 AM »
I'm sorry that I appear on here a lot, but you guys are the only people I know who use danmakufu, or even program. This is going to be a bit lengthy (I'll delete the code when the problem is solved) , and I'm sorry if I missed something obvious, but nowadays, I don't do that as much, cause I wait a little more before asking for help, but this problem randomly occurs.

Anyways, I'm having a very strange problem, I'm not sure if it involves something i'm doing wrong, or a glitch in danmakufu, but this has happened three separate times. One in 0.12m, and two in ph3.
I don't have the 0.12m one anymore, I "fixed" it (Meaning I'm not sure how, and I can't repeat the problem, but)

It has to do with the if statements regarding "<" and ">". Basically It's doing a thing where it does the opposite of what the code says, or is somehow confused in the difference between "<" and ">"

For example, I would write this code (a similar one to the countdown code I had trouble with a while ago in 0.12m)

Code: [Select]
task TimeCheck{
while(ObjEnemyBossScene_GetInfo(bossObj,INFO_TIMER)<=10){
TimerOut;
wait(60);
}
}
It would countdown endlessly, even before it got to 10. I've tried it in an if statement, and in the mainloop, but it wasn't working, oh well...
Code: [Select]
     while(ObjEnemyBossScene_GetInfo(bossObj,INFO_TIMER)>=10)
So, just see what was happening, or to see if it was the path. But the path was fine... Except, it wouldn't countdown at all.

I guessed that I just was using the wrong variable, and ignored this problem... Until it happened again in my player script

Code: [Select]
if(ObjMove_GetY(obj)<10){Obj_Delete(obj);}

When I say (Y<10), it deletes it outright no matter where it is, but with (Y>10), it never deletes and the game lags

I need to specify to delete at that coordinate, hoping to solve ANOTHER gosh-darn problem, where the game keeps lagging after I use the spellcard effect.
« Last Edit: April 19, 2017, 02:20:59 AM by Spacechurro »
task FiteMe{
    loop{
          let m = atan2(MyFistY-YourFaceY,MyFistX-YourFaceX);
          Punch01(GetMyX,GetMyY,100,m,REDFIST01,0);
          wait(1);  }     }

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #528 on: April 19, 2017, 03:13:09 AM »

Firstly, what is the code that calls TimeCheck()? Please provide it so that we have more information to work on. Also note that ObjEnemyBossScene_GetInfo takes a BOSS SCENE OBJECT as its parameter, not a boss enemy object.

Secondly, remember that for Y values, 0 is at the top of the playing field and GetStgFrameHeight (default 448) is the bottom. Your provided code will make a bullet delete if it goes above the enemy lifebar in this screenshot.



Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #529 on: April 19, 2017, 03:18:11 AM »
It's really no problem. We go through long periods of inactivity and sudden spurts of activity just depending on who shows up.

With the timer code, you've mistaken what is going to happen. If your loop is while(time<10), and you're calling it (presumably) when the timer starts, the time will probably not be <10, so the condition will fail and the loop exits; the task then finishes. That's why it will just keep counting down; the task is already over.

I'm not sure what your TimerOut function is supposed to do, but if you want your task to wait for the timer to get down to 10, and then do something every second afterwards, it would look more like this:

Code: [Select]
task TimeCheck{
while(ObjEnemyBossScene_GetInfo(scene, INFO_TIMER) >= 10){
yield;
}
while(ObjEnemyBossScene_GetInfo(scene, INFO_TIMER) < 10){
TimerOut;
wait(60);
}
}
Except if you only need to check every second to see if it's under 10, swapping that yield for another wait(60) is a better idea.

EDIT: Actually, Sparen pointed out what the immediate problem is. If you're using the boss object (and not the scene object) as the first argument to GetInfo, GetInfo will just return 0. Because of this when you're checking for <10 the condition will always be true and when you check for >10 the condition is always false so it never ticks. However, even if you fixed this you'd run into the problem I described above anyway, so my advice is still valid.


I need to see more of the spellcard effect in order to see what you're actually telling it to do. The problem is likely not the if statement itself (it looks fine) but how it's set up. It might also be related to why you're getting lag, depending on what the underlying issue is.
« Last Edit: April 19, 2017, 03:23:15 AM by Drake »

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

Spacechurro

  • FiteMe;
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #530 on: April 20, 2017, 07:02:51 AM »
Quote
what is the code that calls TimeCheck()?
I put in in different places, but the code in written in a library, and I tried to call it in another code in the library that render's the boss's sprite, instead I made another task in the library "DoAll", and put in all the initialize of the singles. (The point of DoAll is to have a control of every Initialize script that applies to every single without having to change EVERY script), I only have TimeCheck; in it right now.
Code: [Select]
task DoAll{
TimeCheck;
}
and yes, I'm trying to make the graphic of the effect delete at the top in case it's not deleting at all and is accumulating.

Quote
I need to see more of the spellcard effect in order to see what you're actually telling it to do.

Oki doki, (and TimerOut is just a pre-loaded sound effect)

Code: [Select]
task SpellGraphic(frames,amount){
let frame = 0;

loop(frames){
if(frame==amount){
BEAMs;
frame=0;
}
frame++;
yield;
}
}

task BEAMs{
let r = rand(100,300);
let X = rand(0,2);
let movex = rand(-1,1);
let movexx = 0;
let move = 0;
let xx = GetPlayerX;
let yy = GetPlayerY-dist;
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(obj,SpellBall);
Obj_SetRenderPriorityI(obj,40);
ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
ObjRender_SetAngleXYZ(obj,0,0,0);
ObjRender_SetColor(obj,50,150,225);
ObjSprite2D_SetSourceRect(obj,0,0,100,100);
ObjSprite2D_SetDestRect(obj,-50,-50,50,50);
ObjRender_SetPosition(obj,GetPlayerX,GetPlayerY,0);

while(!Obj_IsDeleted(obj)){
ObjRender_SetPosition(obj,xx+movexx,yy,0);
ObjRender_SetScaleXYZ(obj,X,X,0);
yy-=15;
movexx+=movex;
X+=0.01;
if(ObjMove_GetY(obj)<10){Obj_Delete(obj);}
yield;
}
}

With the SpellCard task itself, I tested to see what was causing it by deleting the SpellGraphic tasks, and it stopped lagging, so I know it's that. But, each bomb makes it drop 10 fps, and it doesn't bump back up after the spellcard is over, it remains the same low fps. So that's why I tried to use the Obj_Delete to compensate for a possible accumulation (Still not sure if it's that that's happening or not).
task FiteMe{
    loop{
          let m = atan2(MyFistY-YourFaceY,MyFistX-YourFaceX);
          Punch01(GetMyX,GetMyY,100,m,REDFIST01,0);
          wait(1);  }     }

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #531 on: April 20, 2017, 07:24:31 AM »
Note your SpellGraphic task can also be written
Code: [Select]
task SpellGraphic(num, amount){ // number of loops instead of frames
loop(num){
wait(amount);
BEAMs;
}
}

Whether you find that more useful or not is up to you.

Your effect code for the most part looks fine. You should be deleting the objects because they would just accumulate.

The problem is simply that you're calling ObjMove_GetY(obj) to check for position. 2D Sprite objects are not considered Move objects, so they cannot use that function. Instead, the function will just return 0 (i.e. the same problem as with checking the timer). Because of this if you're checking for >10, that will never be true, so the objects will not be deleted. Meanwhile if you check for <10 it will always be true, so the objects are immediately deleted. Simply use ObjRender_GetY(obj), or directly use yy.

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

Zelinko

  • The Wandering Mind
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #532 on: April 20, 2017, 03:52:08 PM »
Is there a way to have Danmakufu continue to run itself when not center of attention?

I'm wanting to be able to record it without it being the active window.  Since I'm not wanting to have my computer being useless for 30 minutes while recording a replay.
This Space For Rent

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #533 on: April 30, 2017, 09:54:15 PM »
Issue with my custom Item Data script:
Whenever I try to run my game, I get an error: "item_image is not defined" in my item data script. I had a similar issue with shot data and somehow worked it out (not sure how unfortunately, was just playing around with stuff). I've read that "item_image" isn't a variable, so this leads me to believe that Danmakufu isn't recognizing it as an item script, meaning it's treating item_image as an undefined variable. Correct me if I'm wrong though.

This contains: item script, item data, and system script (portion)
https://pastebin.com/iGfLv7dy

Any help would be appreciated  :) 

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #534 on: May 01, 2017, 05:21:56 AM »
item_image is not a "variable" because item data sheets aren't scripts to be executed; they're more like configuration files. item_image already has a predefined meaning and the program just checks for the line that says it.

Which should reveal what the problem is. You can't just plop GetCurrentScriptDirectory() in there because it isn't a script to be executed. The text "GetCurrentScriptDirectory()" makes no sense there. It should be something like
Code: [Select]
#UserItemData

item_image = "./filename.png"

ItemData{ //...

In filesystems a single dot . refers to the current directory and two .. refers to the parent directory.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #535 on: May 01, 2017, 06:54:29 PM »
item_image is not a "variable" because item data sheets aren't scripts to be executed; they're more like configuration files. item_image already has a predefined meaning and the program just checks for the line that says it.

Which should reveal what the problem is. You can't just plop GetCurrentScriptDirectory() in there because it isn't a script to be executed. The text "GetCurrentScriptDirectory()" makes no sense there. It should be something like
Code: [Select]
#UserItemData

item_image = "./filename.png"

ItemData{ //...

In filesystems a single dot . refers to the current directory and two .. refers to the parent directory.

I think I was using ./ before and it wasn't working, which is why I switched to GCSD. I played around a bit more and the cause of my error was that I used #include [item data directory] in the stage script I was testing on. When I commented that out, it worked. However I'll stick with your advice in using ./ instead of GCSD, might save me headaches in the future. Thanks!

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #536 on: May 05, 2017, 10:23:59 AM »
So, uh, hi. This is my first post in this section. I'll probably tinker more with danmakufu over the next few weeks.

Right now, I'm trying to make a boss rush patch for Riverbed Soul Saver for someone on the discord channel. I'm just removing all of the stage portions, but keeping the midbosses.
It seems to work perfectly for the first, second, final, extra and phantasm stage, but for some reason, from stages 3-5, the stage will initiate the end animation after dialogue sections.
I'm not too sure what's causing this, which is why I'm posting here.

Here is a link to the patch, it replaced the Road files and just comments out the stage portions.
https://www.dropbox.com/s/e7bdbgk45ytiwtl/broken%20RSS%20boss%20rush.zip?dl=0
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

NLTM

  • Fuck You Marisa
  • I mean, Fuck.
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #537 on: May 11, 2017, 12:16:29 PM »
So lemme preface this by saying I've been messing with Danmakufu for about 6 days now.  I have the very basics mostly down, and I've created at least one pattern I'm happy with just by dinking around. But now I'm starting to get in territory I don't quite understand.

The idea here is to count up phase in one loop, then switch to another when it reaches a certain value, and then reset it back to 0 and start it again. But for whatever reason, it never moves onto the second loop, and just does the first one forever. I've tried putting phase++ in different parts of the task, thinking it was just a syntax issue, but no luck. I'm sure there's a more efficient way of accomplishing this too, but I haven't gotten around to learning it yet.

Code: [Select]
task CircleShoot2{
wait(120);
let angleT=0;
let phase=0;

if(phase < 3){
loop{
loop(20){
ascent(i in -2..2){
let shot2 = CreateShotA1(ObjMove_GetX(objBoss) + 30 * sin(angleT), ObjMove_GetY(objBoss) + 30 * cos(angleT), 3, GetAngleToPlayer(objBoss) + i * 20 + 10 , 136, 5);
}
angleT += 360/20;
}
phase++;
wait(45);
yield;
}
}

if(phase >= 3){
loop{
loop(20){
ascent(i in -2..2){
let shot3 = CreateShotA1(ObjMove_GetX(objBoss) + 30 * sin(angleT), ObjMove_GetY(objBoss) + 30 * cos(angleT), 2, GetAngleToPlayer(objBoss) + i * 20 + 10 , 183, 5);
}
angleT += 360/20;
}
phase = 0;
wait(45);
yield;
}
}
}

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #538 on: May 11, 2017, 12:25:34 PM »

Code: [Select]
loop {} never terminates until you forcefully make it exit via break; or return; I suggest using a while statement.

e.g.
Code: [Select]
while (phase < 3) {/* code */ phase ++;}

NLTM

  • Fuck You Marisa
  • I mean, Fuck.
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #539 on: May 11, 2017, 12:44:14 PM »
Code: [Select]
loop {} never terminates until you forcefully make it exit via break; or return; I suggest using a while statement.

e.g.
Code: [Select]
while (phase < 3) {/* code */ phase ++;}

Alright, got it. Thanks!