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

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #150 on: August 26, 2012, 10:33:30 PM »
You might want to find a better text editor because it seems like a bunch of your errors are due to mismatched brackets and you're unable to find where those mismatches are. Maybe if you get some bracket highlighting up in there you can start concentrating on things that matter.

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

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #151 on: August 27, 2012, 02:35:15 AM »
It doesn't work, though I have a feeling I removed some braces I shouldn't have. Here is the new script.
My Youtube Channel. I mostly upload Hisoutensoku videos.

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #152 on: August 27, 2012, 02:57:01 AM »
Have a version with the brackets as they should be.
I would suggest Notepad++ for that, as when you click on a bracket it shows the partnered one.

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #153 on: August 27, 2012, 04:57:40 PM »
Great. Just great. When I remove the end bracked, it gets a mismatched brackets error. When I add the bracket, the script is terminated and the game crashes. ???
My Youtube Channel. I mostly upload Hisoutensoku videos.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #154 on: August 27, 2012, 09:33:08 PM »
Dude are you actually looking at the brackets and how they match up? Or even, do you understand what the brackets do and why they're there? The revision IHNN gave you should be fine.

If you remove "the end bracket" as in the final final bracket at the end of the file, you then are either not ending the script, or some parts of the script are cut off. If you add a bracket in a place that matches up with script_enemy_main's opening bracket before some other parts of your script, then the script obviously closes early and the same happens.

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

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #155 on: August 28, 2012, 05:00:44 PM »
Hi, i have a BIG problem... i am trying to learn the ARRAYS, and i tryed evrithing : tutorials online, tutorials here, etc etc...

Now, or i am dumb or i don't really know... but seeing lines like   a = [ 0 , 1 , 2 , 3 ] or similar i don't understand nothing. Also, i can't apply arrays in the scripts...i mean, i don't even know how to make bullets and controlling them using arrays!

So, if someone could explain me the arrays, ( from less than zero... i barely understand what is the meaning of the word array!) i would be really gratefull.


Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #156 on: August 29, 2012, 06:33:52 AM »
Let's take this in steps.

If I put let str = "words words and more words"; you understand what that is right? The variable str is holding the string "words words and more words" which you can use in a function if you want to. Something like DrawText(str, GetCenterX(), GetCenterY(), 12, 255);

Now let's take a very basic look at arrays. If I put let arr = ["string1", "string2", "string3"]; then I have an array with three strings. Obviously, because an array is not a string, you cannot use it like a string. As such,  DrawText(arr, GetCenterX(), GetCenterY(), 12, 255); will not work. However, there is a way to take each string out of the array to use it. If I put let str = arr[0] then the variable str will now hold the string "string1". The 0 in the square brackets ("[" and "]") is telling it to grab the 0th thing in the array (computers start at 0 instead of 1 so 0th place to a computer is 1st place to humans) which happened to be "string1".

Anyway, now that you have your str variable which equals "string1", you can use it in the DrawText function like normal: DrawText(str, GetCenterX(), GetCenterY(), 12, 255); However, you do not have to put arr[0] (or arr[1] or arr[2]) into a new variable first before you use it. Instead, you could just do this instead: DrawText(arr[0], GetCenterX(), GetCenterY(), 12, 255);

Basically, arrays are a group of things rather than a single thing, which you can put into a variable. You can also think of it as a way for a variable to hold many values at the same time under the same name. Do you understand this so far? If so, try taking a look at some tutorials again because if I go any further I'll probably be repeating things that have been written many times already. If you don't understand, try to point out what doesn't make sense with examples and I'll try my best to clarify.
« Last Edit: August 29, 2012, 06:39:22 AM by Blargel »
<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.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #157 on: August 29, 2012, 09:59:36 AM »
Mmm... thanks Blargel, i'm trying to understand what you wrote.
In the mean time, i give you an example of one of my standard problems with the arrays:

Create a stream of bullets where each bullet at a given time (or from the start) go in different directions...
i understand i have to make an array with all the wanted directions and use it in the bullet function... but since i still have problems understanding arrays, i can say that i have an almost clear idea of why and how to use them.

What i lack, are the mathematical skills and scripting abilityes to use them... i really can't understand how to write strings involving arrays.

And that is why i don't understand tutorials, they give many technical info but i guess i am one of those people who need also practical examples to understand a concept.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #158 on: August 29, 2012, 04:50:28 PM »
In the mean time, i give you an example of one of my standard problems with the arrays:

Create a stream of bullets where each bullet at a given time (or from the start) go in different directions...

I'm not sure why an array would be necessary for that. You could just write CreateShot01 multiple times without any variables whatsoever to accomplish this. However, you would be right in thinking that you could shorten the code by using an array if you really wanted to.

No array version:
Code: [Select]
CreateShot01(GetX(), GetY(), 3, 10, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 25, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 30, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 47, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 62, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 99, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 122, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 136, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 154, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 169, RED01, 10);

Array version (not shortened)
Code: [Select]
let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];

CreateShot01(GetX(), GetY(), 3, angles[0], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[1], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[2], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[3], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[4], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[5], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[6], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[7], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[8], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[9], RED01, 10);

Array version (shortened)
Code: [Select]
let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
let i = 0;
while(i < length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles[i], RED01, 10);
  i++;
}

Array version (shortened, also using ascent)
Code: [Select]
let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
ascent(i in 0..length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles[i], RED01, 10);
}

I wasn't sure if you knew how to use ascent, but if you don't then just ignore that last one. It's just me trying to make it as short as possible. Anyway, each block of code there does the same thing.
« Last Edit: August 29, 2012, 05:21:33 PM by Blargel »
<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.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #159 on: August 29, 2012, 10:08:12 PM »
Wow Blargel, thank you so much!

But there is something i don't understand....

let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
let i = 0;
while(i < length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles, RED01, 10);
  i++;
}

why angles ? you said that angles was = the array, so if you put ...danmafuku won't use 0 since you wrote let i = 0;     ?

Also in while(i < length(angles)){ what is the meaning of "length" in danmakufu speech?

You know, i'm trying to learn arrays so that in the future i could do Nue spell "Danmaku chimera", because i bet he used arrays to make the bullets

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #160 on: August 29, 2012, 10:17:14 PM »
in that example, angles[0] points to the first element in the array, in this case, the 10.

let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
let i = 0;
while(i < length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles[ i ], RED01, 10);
  i++;
}

why angles[ i ] ?
angles[ i ] points to the i-th element in the array, and the code there cycles through every element int he array and will shoot a bullet in those angles.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #161 on: August 30, 2012, 12:14:06 AM »
You guys keep posting [i] and activating BBCode italics. Good job lol.

Matteo, putting in let i = 0; was just to declare the variable and give it an initial value. length(array) is a function that returns the size/length of an array; with the angles array it would return 10, since there are 10 elements in the array. So, the while loop means "while i is less than 10", basically. At the end of the loop, it increments i, so i loops from 0 up to 9. So where it says angles[i], it loops through the contents of the array since it will be angles[0] then angles[1] then angles[2] and so on.

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

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #162 on: August 30, 2012, 09:01:00 AM »
Ok, really thank you so much evryone...and Drake, thanks for your excellent explaination.

I'm starting to get it i think, but i found a huge problem in a pattern i made.

I wanted to create a line of bullets that first go down, then after 90 frames the array start and each bullet go up,down,up,down,etc etc...

But i really can't grasp it...it's almost 2 hours of tryes!

task aimed{
   loop{
      let a = 0;
   loop(30){

      Bullet(32+a, GetY(), 2, 90, RED01, 60);
      a += 20;
      wait(5);
      }
      wait(60);
      }
         
}

This is the line of bullet obj, and this

task Bullet(x, y, v, angle, graphic, delay) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);
wait(90);
let angles = [90, -90];
      Obj_SetAngle(obj, angles[0,1]);      
}

is the obj, where i tryed to set that the bullets had to go after 90 frames up,down,up,down,etc etc...

Before you say "where is the i, the lenght function explained before etc etc" , i tryed them too and the only thing i got was that all the bullets went up (so i guess only the -90 of the array worked).

I really don't understand where i do wrong... (even if i think that maybe my i don't return to 0, so it remains in the last place of the array, [-90] )  But... while, if and in geveral values++; never worked to me inside tasks.

Boh, again i need help, and again i'm here to bother you with this things that i realize are simple for most scripters...

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #163 on: August 31, 2012, 12:46:42 AM »
I'm not entirely sure what you want the end result to be, but I'm assuming you want each horizontal line of bullets to break off so that every odd-numbered bullet goes up and every even-numbered bullet goes down, or something.

If that's the case, then you can do it a different way where you don't need arrays at all. Instead, you add a parameter to your bullet function that tells the bullet which angle to change to after the 90 frames. Then, all you need is an extra variable for your 30-bullet loop that switches between 90 and -90. If you initialize the variable to either, you can switch between the two simply by going angle *= -1; which will multiply the number by -1 and so switch its sign.

Code: [Select]
task aimed{
   loop{
      let a = 0;
      let angle2 = 90;   //initializes angle2 to 90
      loop(30){
         Bullet(32+a, GetY(), 2, 90, RED01, 60, angle2);
         a += 20;
         angle2 *= -1;   //flips angle2 from 90 to -90 and vice-versa
         wait(5);
      }
      wait(60);
   }
}

task Bullet(x, y, v, angle, graphic, delay, angle2) {
   let obj=Obj_Create(OBJ_SHOT);
   Obj_SetPosition(obj, x, y);
   Obj_SetAngle(obj, angle);
   Obj_SetSpeed(obj, v);
   ObjShot_SetGraphic(obj, graphic);
   ObjShot_SetDelay  (obj, delay);
   ObjShot_SetBombResist (obj, true);
   wait(90);
   Obj_SetAngle(obj, angle2);
}

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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #164 on: August 31, 2012, 01:37:30 AM »
Quote
let angles = [90, -90];
      Obj_SetAngle(obj, angles[0,1]);     
}

Quote
angles[0,1]

How did you not get a syntax error?
<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.

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #165 on: September 18, 2012, 03:11:50 AM »
Sorry to bump the thread, but I need even more help. Sorry to be so annoying, but I put this at the very end of my script:
Code: [Select]
function wait(w){15;
loop(w) { yield; }
}
I always get a syntax error when I execute it. I worked out (almost) all the kinks, and if I were to clear that one out I'd have a better understanding of my script. Please help and thanks. :)
My Youtube Channel. I mostly upload Hisoutensoku videos.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #166 on: September 18, 2012, 03:28:31 AM »
What is the 15; doing there, exactly.

Alternately, make sure you're still putting it inside the script_enemy_main scope and not after it closes.

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

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #167 on: September 18, 2012, 04:27:13 AM »
Ah. The 15 was supposed to represent how many frames to wait, I'll change it back to zero.

Where in script_enemy_main should I put it?
« Last Edit: September 18, 2012, 04:28:56 AM by LadyScarlet »
My Youtube Channel. I mostly upload Hisoutensoku videos.

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #168 on: September 18, 2012, 05:37:02 AM »
Ah. The 15 was supposed to represent how many frames to wait, I'll change it back to zero.

Where in script_enemy_main should I put it?
That number doesn't need to be there at all.  In fact, that's why it's breaking.
I have it at the very bottom of script_enemy_main.

When you want to have it wait 15 frames, you go to where you want it to wait and type "wait(15);".
That will make it wait 15 frames.  The number inside the function tells it how long to wait.

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #169 on: September 19, 2012, 12:58:16 AM »
Okay, so I worked out the bugs and redid the graphics. Now my first spellcard looks like this:

The blue bullets are aimed at you, the aqua bullets change position slightly with each spin and the purple bullets I haven't paid much attention to.

The purple orb covers the boss. Any idea how to fix that? I want people to see Yukari (who is now with her CtC sprite instead of her PCB one).
My Youtube Channel. I mostly upload Hisoutensoku videos.

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #170 on: September 19, 2012, 02:02:19 AM »
Do you have a delay cloud?  If so, that's why.  Delay clouds are mostly useful for when the bullets don't spawn from the boss.

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #171 on: September 19, 2012, 03:23:10 AM »
So that's fixed. However, I don't want the spell card to be TOO cheap. I want to give the player a chance to read the blue bullets by making them start later, and especially not before the spell even starts. How do I fix that? Here's the code for the blue bullets:
Code: [Select]
CreateShot01(GetEnemyX,GetEnemyY,30,GetAngleToPlayer,BLUE04,0);
My Youtube Channel. I mostly upload Hisoutensoku videos.

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #172 on: September 19, 2012, 03:26:59 AM »
If I'm reading that right you have a speed of 30.  That's honestly excessive, 30 pixels per frame gives something like 12 frames (.2 seconds) to react.
besides, if the delay is to allow the player to read the bullets, how does a solid cloud help with that?

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #173 on: September 19, 2012, 11:55:15 PM »
So delay just gives a cloud? Well that bites. Thanks.
My Youtube Channel. I mostly upload Hisoutensoku videos.

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #174 on: September 20, 2012, 12:27:40 AM »
So delay just gives a cloud? Well that bites. Thanks.
Yeah, for bullets it gives a cloud but for lasers it shows the path of the center of the laser (this is non-indicative of width)

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #175 on: September 20, 2012, 01:20:43 AM »
So delay just gives a cloud? Well that bites. Thanks.
What are you expecting, rather? You fire a bullet with delay 20, it's going to make a delay cloud for 20 frames and then the bullet is fired. If you have delay 0, there is no delay cloud and the bullet fires immediately. How does this bite.

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

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #176 on: September 20, 2012, 01:22:52 AM »
I think he wanted to show the path of the bullet before it fires.

I just realized that's possible with a laser of, say, delay 20 and duration 20 (along with keeping the bullet at delay 20) and you shoot them at the same time.  The laser shows the path the bullet will take then goes away when the bullet fires.

Pepperized

  • Youmunerd
  • I'm not very good at danmaku.
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #177 on: September 26, 2012, 07:38:39 PM »
This requires you to be pretty damn good at maths:
I am trying to make a cardioid http://en.wikipedia.org/wiki/Cardioid (heart-shape) danmaku pattern, so far so good, until I notice it is upside down, after hours of trying and googling I have to give up and come here, this is the small amount of code that makes the shape:
Code: [Select]
task fire{
loop{
let x = 0;
let dir = 0;
while(x<37){
CreateShotA(1,(GetEnemyX+50*(2*sin(dir)-sin((dir*2)))/3),(GetEnemyY+50*(2*cos(dir)-cos((dir*2)))/3),30);
SetShotDataA(1,0,0,90,0,0,0,AQUA01);
FireShot(1);
wait(3);
yield;
x++;
dir-=360/36;
}
SetShotDataA(1,60,2,GetAngleToPlayer,10,1,2,AQUA01);
x = 0;
yield;
}
}

And a screenshot of what is currently happening.

« Last Edit: September 26, 2012, 07:41:03 PM by Pepperized »
Moedan Card Combinations
"If you cannot do any better than this replay during a serious run, I feel sorry for you." - Drake

;~;

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #178 on: September 27, 2012, 01:57:40 AM »
Change (GetEnemyY+50*(2*cos(dir)-cos((dir*2)))/3)
into (GetEnemyY-50*(2*cos(dir)-cos((dir*2)))/3)
<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.

Pepperized

  • Youmunerd
  • I'm not very good at danmaku.
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #179 on: September 27, 2012, 04:21:59 PM »
Holy shit...

It was that easy all along, thank you and kudos to you.
Moedan Card Combinations
"If you cannot do any better than this replay during a serious run, I feel sorry for you." - Drake

;~;