Author Topic: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)  (Read 140408 times)

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #180 on: June 07, 2011, 12:53:47 AM »
Okay my last post was completely irrelevant but whatever, it's still good advice :V .

Your second fire task isn't working because you never tell it to start anywhere. Try adding this in your mainTask:

        task mainTask{
                wait(60);
                yield;
                fire;
                fire2;
        }
<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.

rogus247

  • Rogus is serious...
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #181 on: June 07, 2011, 01:04:26 AM »
omg thank you! i forgot you had to set it there! Ok, and question 3/4 for today is.........how do you make bullets go in a circular motion around the boss? Like for example, how do i make a couple of bullets spawn from my boss, and comtinue to move arould like a pinwheel? I know the code involes something with the whole 360 degress thing, but how does it work?

And last thing, how do you spawn lazers from points on the map? Like, I want 2 lazers, one on each side of my boss, firing, and spreading bullets? (I know this is a little complicated, cause it has to do with obj. shots...so feel free to skip this question if you cant explain it well xD)
"Think you got what it takes to beat me? Ive blown up universes before, so what makes you think you got a chance?" -Rogus

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #182 on: June 07, 2011, 01:33:48 AM »
I can explain anything about Danmakufu that you want, but the problem is that I have to get you understanding the basics of it first before you start building upon those basics to learn the more complex things. For your first question, the easiest way is with shot objects. I'd try to explain it for you right now, but I don't think you're quite ready for it yet, judging from the code you had in your pastebin. For your other question, you can try using CreateLaserA and it's corresponding functions. To delete a laser that never leaves the screen, you'll need to use SetShotKillTime before firing it, which is also on the same page as that link. To make bullets appear from the laser, you can try using AddShot, though that's a little complicated when you try adding shots to lasers.

Fool around with the functions on that page and see if you can figure out how they work. There's too much to explain that you could probably figure out with experimentation.
<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.

rogus247

  • Rogus is serious...
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #183 on: June 07, 2011, 02:04:00 AM »
Blargel, you are AMAZING! Thanks so much for your help! I got my first spell card up and running! Its really cool too! Check it out if you want peoples! :D
http://pastebin.com/gXNTvHzx

Not sure about the image or music...oh well! :D
« Last Edit: June 07, 2011, 02:08:01 AM by rogus247 »
"Think you got what it takes to beat me? Ive blown up universes before, so what makes you think you got a chance?" -Rogus

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #184 on: June 07, 2011, 02:37:02 AM »
* みゅーキュゥ slaps rogus247 across the face
Never pull the "kill while still on the cut-in" trick again! Replay!

rogus247

  • Rogus is serious...
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #185 on: June 07, 2011, 02:56:39 AM »
0_0 huh?
"Think you got what it takes to beat me? Ive blown up universes before, so what makes you think you got a chance?" -Rogus

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #186 on: June 07, 2011, 02:58:25 AM »
Isn't a big deal at your level, but generally most patterns wait a while after the script starts, to start firing bullets. Pay it little mind, though.

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

rogus247

  • Rogus is serious...
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #187 on: June 07, 2011, 03:01:42 AM »
oh im sorry...ok here, i made it wait a little while. hope this is better!

http://pastebin.com/zq64mJps

Also, can someone give me an example of CreateLaserB and such? I almost have it working, but im making mistakes a lot...
"Think you got what it takes to beat me? Ive blown up universes before, so what makes you think you got a chance?" -Rogus

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #188 on: June 07, 2011, 03:44:10 AM »
Hi everyone, danmakufu noob reporting in :)

I've only had one basic programming class and it didn't really get into tasks and functions, so a lot of this stuff is new to me. As such, when I started messing around with some of the concepts from the intermediate and advanced tutorials  I'm pretty sure I managed to make an infinite loop even in a relatively simple code - danmakufu freezes and requires a forcequit any time I play this card:

http://pastebin.com/Fb1is7ZH

If anyone happens to be able to take a quick look at this and see where it went wrong, and unless it's something really stupid I should already know better than to do, perhaps impart some CompSci knowledge as well, I'd appreciate it!

(major thanks to Blargel, Naut, Iryan, and Stuffman for the tutorials by the way - they've been super helpful thus far!)

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #189 on: June 07, 2011, 04:45:42 AM »
Wave should be a task, not a function. You use yield in it, and you want that yield to pause it for a frame - that only works in a task.

I'll give more detail tomorrow if you want (and if nobody else does). It's a pain to type on this touch-screen keyboard...
« Last Edit: June 07, 2011, 04:47:25 AM by Azure Lazuline »

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #190 on: June 07, 2011, 05:48:09 AM »
oh im sorry...ok here, i made it wait a little while. hope this is better!

http://pastebin.com/zq64mJps

Also, can someone give me an example of CreateLaserB and such? I almost have it working, but im making mistakes a lot...


CreateLaserB(id, length, width, graphic, delay);
SetLaserDataB(id, frame, lengthening speed, distance from enemy to laser,distance change,angle from enemy to laser,angle change,laser angle,laser angle turn speed);

example:
Code: [Select]
ascent(i in 0..30){
CreateLaserB(i, 100, 20, RED03, 60);
SetLaserDataB(i, 0, 0, 100, 0, 0+i*12, 1, 180+i*12, 1);
FireShot(i);}

Sets up 30 lasers around the boss, pointing towards the boss, as well as spinning.

Hope i didn't make anything wrong...
« Last Edit: June 07, 2011, 10:14:51 AM by Darkness1 »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #191 on: June 07, 2011, 04:50:45 PM »
Wave should be a task, not a function. You use yield in it, and you want that yield to pause it for a frame - that only works in a task.

I'll give more detail tomorrow if you want (and if nobody else does). It's a pain to type on this touch-screen keyboard...

Thanks - changed this and it worked (just gotta play with the settings to get the card to work like I want it to). I think I misinterpreted the difference between a task and a function (assumed tasks could not be called with variable inputs). Was the problem that when the Wave function was called in MainLoop, it got stuck waiting for a return value, which it wouldn't get due to the yield statements?

Also quick question offhand - what is the size of the Danmakufu screen in pixels? I estimated it at about 400 x 480, but knowing for sure would be helpful.

Schezo

  • en-counse
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #192 on: June 07, 2011, 04:54:28 PM »
384x448 pixels.

(224, 240) is the center point of the field.
(32, 16) is the top left.
(416, 16) is the top right.
(32, 464) is the bottom left.
(416, 464) is the bottom right.

All these values can be substituted with...
(GetCenterX, GetCenterY) as the center point.
(GetClipMinX, GetClipMinY) as the top left.
(GetClipMaxX, GetClipMinY) as the top right.
(GetClipMinX, GetClipMaxY) as the bottom left.
(GetClipMaxX, GetClipMinY) as the bottom right.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #193 on: June 07, 2011, 05:38:55 PM »
Hi everyone, danmakufu noob reporting in :)

I've only had one basic programming class and it didn't really get into tasks and functions, so a lot of this stuff is new to me. As such, when I started messing around with some of the concepts from the intermediate and advanced tutorials  I'm pretty sure I managed to make an infinite loop even in a relatively simple code - danmakufu freezes and requires a forcequit any time I play this card:

http://pastebin.com/Fb1is7ZH

If anyone happens to be able to take a quick look at this and see where it went wrong, and unless it's something really stupid I should already know better than to do, perhaps impart some CompSci knowledge as well, I'd appreciate it!

(major thanks to Blargel, Naut, Iryan, and Stuffman for the tutorials by the way - they've been super helpful thus far!)
To clarify it a bit more, only Danmakufu has something called tasks, but most other programming/scripting languages have functions. Some languages have something called coroutines which are pretty much what tasks are in Danmakufu. Interestingly, some languages allow coroutines to yield values, which would be interesting, but I'm honestly not sure how often I'd use that in a Danmakufu script if it were allowed.

The difference between functions and tasks is how they deal with yield and return. A function can use return value; to exit the function and spit out a value in place of where it was called. For example, GetCenterX is a function that always returns 224. You can put let cx = GetCenterX and it's the same as replacing the function with 224. This makes functions ideal for mathematical functions that are used very often, such as the distance formula:
Code: [Select]
function GetDistance(x1, y1, x2, y2){
    return ((x1-x2)^2+(y1-y2)^2)^0.5;
}
Of course, you can also use functions that fire a pattern of bullets in different ways as well.

Lastly, the behavior of yield in a function depends entirely on whether you are calling the function in a task or in any other part of the script. This is because the behavior yield itself depends on where it is. Yielding in a task will cause that task to pause until a yield is called in a nontask environment (e.g. @MainLoop). Remember the wait function that a lot of people use? It's just a function that places a given amount of yields where you called it. This function obviously is for use in tasks, but if you were to put it in @MainLoop, it wouldn't cause any syntax or runtime errors; it would just cause any tasks you're using to run much faster, assuming you put a value more than 1 into the function.



A task is basically the same thing as a function except that it cannot return a value, and yield behaves differently in one than anywhere else in a script. I've already mentioned that yield will pause a task until yield is called again elsewhere in a nontask environment, usually @MainLoop. In 99.99% of the cases, you'll be having yield in @MainLoop at the very end so that it is being called once every frame, effectively causing each yield in a task to pause that task for a single frame. As for using return, since it might be running over a period of time, it doesn't make sense for it to be able to return a value. However you may still use return without a value to end a task prematurely.
<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.

rogus247

  • Rogus is serious...
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #194 on: June 07, 2011, 09:22:00 PM »
Thanks for the LaserB thing! ...only one problem. It makes too many lasers, and it lags the game...how do i reduce the number of lasers in this?

http://pastebin.com/dgZmGRcv

Also, can someone explain why SetShotKillTime doesnt work with letters...is it because in this situation, there not the id it needs?
"Think you got what it takes to beat me? Ive blown up universes before, so what makes you think you got a chance?" -Rogus

Schezo

  • en-counse
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #195 on: June 07, 2011, 09:49:25 PM »
You need to declare, SetShotKillTime(x, y); before you call FireShot(x);

And it's lagging a lot because you are waiting 1 frame to respawn 30 more lasers when they are being deleted at a rate of after 120 frames of waiting. So you essentially have 3600 lasers on the field on top of each other when you could be using your wait(x); function to delay when your lasers will spawn in place of your yield;  Use that to make only those 30 appear and be deleted then spawned again.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #196 on: June 07, 2011, 09:52:26 PM »
Small breakdown.

ascent(i in 0..30){
In one frame, the following code loops thirty times, incrementing a local variable i.

    CreateLaserB(i, 100, 10, RED03, 60);
    SetLaserDataB(i, 0, 0, 100, 0, 0+i*12, 1, 180+i*12, 1);

Creates and sets up a laser, with an incrementing id from 0 to 29.

    FireShot(i);
Fires the laser you set up, as its id is also the same.
    }
Loops back to the ascent and increments i. This happens 30 times.
As a result, there are 30 individual lasers being fired every frame.

SetShotKillTime(i,120);
Sets the shot deletion time of undefined bullet i. There is no bullet with the id of i as it is outside the ascent loop, and in addition it's set up after a shot would be fired and thus would be useless anyways.

yield;
Cut to the next appropriate open yield statement. (i.e. wait a frame)



I'd like you to try and figure out how to fix this yourself first.

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #197 on: June 07, 2011, 09:53:12 PM »

Schezo

  • en-counse
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #198 on: June 07, 2011, 10:17:48 PM »
deja vu
It was very helpful to me, thank you.
« Last Edit: June 07, 2011, 10:21:29 PM by Schezo »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #199 on: June 07, 2011, 11:43:52 PM »
Thanks Azure, Blargel, and Schezo! I'm pretty amazed at how helpful / responsive people are in this thread.

Got my first ever spell card working pretty much as intended - it's quite simple and not particularly pretty, but it fulfills the idea I had and is a reasonable difficulty, so I'm happy with it. I might open up a thread in a couple days (internet is way too slow here to upload stuff to youtube) so everyone can make fun of me and/or give constructive criticism; we'll see if I've got anything else to show by then.
« Last Edit: June 13, 2011, 01:01:10 AM by BajaBlood »

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #200 on: June 08, 2011, 12:21:22 AM »
It's a lot easier to critique and help people when they understand what we're talking about right away and can somewhat come to conclusions by themselves instead of us forcefeeding people answers, so reading your posts is like a breath of fresh air. As you've seemingly just started out and you're already getting the hang of things with even just a bit of a programming background, I look forward to see what you can dish out.

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

rogus247

  • Rogus is serious...
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #201 on: June 08, 2011, 12:27:44 AM »
OK PEOPLE! Im finished with 3 of my first spell cards! If you wanna check em out, please do!

Blind sign - Possessed iris of death -
http://pastebin.com/bTV6aSKj

Hell - Edge of the fire blade -
http://pastebin.com/nbCx9MGv

WARNING! THIS ONE WILL MAKE YOU CRY! You have been warned...xD
Blind sign "4 fans of light"
http://pastebin.com/a9gB5jyu

Thanks to: Blargel, Drake,Naut,Schezo,and Darkness1 for the LaserB help!
You guys are the best! Oh, and AzureLove, thanks for your help too!
"Think you got what it takes to beat me? Ive blown up universes before, so what makes you think you got a chance?" -Rogus

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #202 on: June 08, 2011, 01:37:18 AM »
Please watch this post, making replays...
EDIT: Am I supposed to not be able to hit the boss 90% of the time?
« Last Edit: June 08, 2011, 01:40:11 AM by みゅーキュゥ »

rogus247

  • Rogus is serious...
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #203 on: June 08, 2011, 02:04:25 AM »
2 things:

1) lol did you use reimu A? xD Its suppose to be a shoot and dodge thing...i guess cause im more skilled, i made em hard...lol im sorry if you failed. Just practice!  :3

2) cant see the replay...
"Think you got what it takes to beat me? Ive blown up universes before, so what makes you think you got a chance?" -Rogus

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #204 on: June 08, 2011, 04:31:28 AM »
2 things:

1) lol did you use reimu A? xD Its suppose to be a shoot and dodge thing...i guess cause im more skilled, i made em hard...lol im sorry if you failed. Just practice!  :3

2) cant see the replay...

How skilled are you?
As a Lunatic (for seriousness. I usually play Hard) player I should be able to capture many newbies' first spell cards.....

... Wait, Are you mocking me?!
I will make sure you pay for that!
* Mewkyuu rants on for fifteen more minutes before running out of shit to say

EDIT: I actually did capture that spell card...! It was really hard, but I captured it in 3 tries! What the fuck do you want now?
« Last Edit: June 08, 2011, 04:43:35 AM by みゅーキュゥ »

TAKE IT CACODEMON!!

  • OKAY THEN I'M A LEGAL AIDE
  • AND ERIN BROCKOVICH IS MY NAAAME
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #205 on: June 08, 2011, 07:07:13 AM »
Hey, I got AppLocale and tried to use it with Danmakufu, but I'm still getting an instant error message even when I set the language to Japanese. I'm on Windows Seven, 64-bit.
Sonata of Scarlet Sunflowers, a Flandre x Yuuka story. | Laziness of Daemonic Wastrels, wherein The Dude, Frylock, HW Guy, and David Wong get their asses kicked in Gensokyo.  | T.O.U.H.O.U.: Land of Shadows, a S.T.A.L.K.E.R./Touhou crossover. | Abomination, a monster story.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #206 on: June 08, 2011, 07:56:27 AM »
If the language is set then the error message won't display in garbage text. Please screencap or copy it, we aren't magic.

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

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #207 on: June 08, 2011, 09:01:50 AM »
How skilled are you?
As a Lunatic (for seriousness. I usually play Hard) player I should be able to capture many newbies' first spell cards.....

... Wait, Are you mocking me?!
I will make sure you pay for that!
* Mewkyuu rants on for fifteen more minutes before running out of shit to say

EDIT: I actually did capture that spell card...! It was really hard, but I captured it in 3 tries! What the fuck do you want now?

Mewkyuu, don't get pissed at him for not knowing...

YES, I'M NOT DEAD :V
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

J.O.B

  • YOU CAN'T MAKE ME CHANGE
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #208 on: June 08, 2011, 10:36:46 AM »
Can someone help me?
I keep getting this error message whenever I play my script.
---------------------------
ScriptError「yadayadayadayadaydayady.....]
---------------------------
Bullet1は未定義の識別子です(20行目)

              Bullet1(a, b, c);

       }

        if(frame==20){

                          Sinuate Laser}

               
~~~
---------------------------
OK   
---------------------------
Here is the code I have.
Code: [Select]
#TouhouDanmakufu
#Title[wkbcvjvhbd]
#Text[Boss Initialization with almost everything you could possibly need stuck in @Initialize]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    @Initialize {
        SetLife(1000);
        SetTimer(50);
        SetEffectForZeroLife(180, 100, 1);
        SetMovePosition02(GetCenterX, GetCenterY, 3);
    }
    @MainLoop {
       SetCollisionA(GetX, GetY, 32);
       SetCollisionB(GetX, GetY, 24);
       frame++;
       if(frame==10){
              Bullet1(a, b, c);
       }
        if(frame==20){
                          Sinuate Laser}
                          frame = 0;
                          yield;
       }
    }

    @DrawLoop {
    }

    @Finalize {
    }
task Bullet1(a, b, c){
                 let timer=30;
                 while(timer>0){
                        let 1=Obj_Create(OBJ_SHOT);
                        Obj_SetPosition(1, GetX, GetY);
                        Obj_SetAngle(1, rand(0, 359));
                        Obj_SetSpeed(1, rand(1, 5));
                        ObjShot_SetGraphic(1, RED01);
                        while(Obj_BeDeleted(1)==false) {
                                           yield;
                        }   
                 }
}
    task Sinuate Laser{
         let obj1=Obj_Create(OBJ_SINUATE_LASER);
         Obj_SetPosition(obj1, GetX, GetY);
         Obj_SetAngle(obj1, GetAngleToPlayer);
         Obj-SetSpeed(obj1, rand(1, 5));
         ObjSinuateLaser_SetLength(obj1, 40);
         ObjSinuateLaser_SetWidth(obj1, 10);
         yield;
    }
}
I would really like some help on this as this has really been annoying me for the past few hours.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #209 on: June 08, 2011, 10:44:55 AM »
in your @MainLoop

Quote
Sinuate Laser}

you better fix that :V

EDIT: also, I don't think you can use multiple words to name tasks... try using something like Sinuate_Laser or SinuateLaser instead
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry