Author Topic: Danmakufu Q&A/Problem Thread v3  (Read 213421 times)

Furienify

  • Yeehaw!
  • Equestrian Fansubber
    • Youtube Channel
Re: Danmakufu Q&A/Problem Thread v3
« Reply #510 on: March 29, 2010, 10:48:07 PM »
AHASHAHAHA I found an error

You forget the closing ] bracket in one of the #Text[] lines.

Therefore the entire script was considered to be the text for the script. However, since danmakufu reads the playing part of the script from script_enemy_main onwards, the script was still playable. Then, when archiving, things gout fucked up.

http://www.youtube.com/watch?v=VcHJvsOb984


Moep, now I may just as well listen Octavarium through till the end.  :V

It WORKS! Thanks so much. :*

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #511 on: March 30, 2010, 03:29:24 AM »
tried the 2D arrays idea... now CURRENTHS always gives me 0... It's not changing/updating the value... don't know if I'm doing this right or not...

Code: [Select]
SetCommonData("HISCOREARRAY", [[0,0,0,0],[0,0],[0,0,0,0 blah blah etc... ]);
let array= [blah, blah2, blah3];
SetCommonData(GetCommonData("HISCOREARRAY")[0], array);
SetCommonData("HISCOREARRAY"[0], array);
^these lines aren't actually part of the code... they're just there to show the basis of the code...

I've never used arrays for common datas...

Code: [Select]
if(GetCommonData("SCORE")>GetCommonData("HISCOREARRAY")[0][0])
{
SetCommonData("HISCOREARRAY"[0], array); //or SetCommonData(GetCommonData("HISCOREARRAY")[0], array);
}
SetCommonData("CURRENTHS", GetCommonData("HISCOREARRAY")[0][0]);

None of them are working... :ohdear:
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #512 on: March 30, 2010, 04:43:13 AM »
GetCommonData("HISCOREARRAY")[0][0]

You put the array index in the wrong place.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #513 on: March 30, 2010, 06:51:29 AM »
GetCommonData("HISCOREARRAY")[0][0]

You put the array index in the wrong place.
I don't really get what you said... cause that's exactly what was in my code... (I'm an idiot :/)

I did some testing... moved pieces of code around and stuff... and as I thought
Code: [Select]
SetCommonData(GetCommonData("HISCOREARRAY")[0], hsarrayb);
this line has always been the problem... I really don't know how to change arrays INSIDE commondatas...

Code: [Select]
hsarrayc=GetCommonData("HISCOREARRAY");
hsarrayb=[GetCommonData("SCORE"), GetCommonData("HISCOREARRAY")[0][1],
GetCommonData("HISCOREARRAY")[0][2], GetCommonData("HISCOREARRAY")[0][3] ];
hsarrayc[0]=hsarrayb;
if(GetCommonData("SCORE")>GetCommonData("HISCOREARRAY")[0][0])
{
SetCommonData("HISCOREARRAY", hsarrayc);
}
SetCommonData("CURRENTHS", GetCommonData("HISCOREARRAY")[0][0]);
What a workaround... :V at least I got it working...
« Last Edit: March 30, 2010, 07:17:14 AM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #514 on: March 30, 2010, 04:38:31 PM »
Oh, I misread your SetCommonData("HISCOREARRAY"
  • ,something) line as GetCommonData, my bad. (Hey, it's only one letter different and it was really late at night...) Yeah, in order to change only one value, you have to use that workaround you found out. At least it works, right?

Nobu

  • Serendipitous Youkai
  • *
  • i post while naked
    • My Tumblr
Re: Danmakufu Q&A/Problem Thread v3
« Reply #515 on: March 30, 2010, 10:47:40 PM »
Quick dumb question here. I'm trying to append object ids to an empty array, but I get the error that i'm not concatenating the write data type. Do I have to turn the object ID into a string or something, or do something special with the array?

Relevant code:

let thearray = [];

let obj = Obj_Create(OBJ_SHOT);
thearray =  thearray ~ obj;
Tumblr (sometimes NSFW) | PM for Facebook

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #516 on: March 30, 2010, 11:01:25 PM »
thearray =  thearray ~ [obj];

should work.

Nobu

  • Serendipitous Youkai
  • *
  • i post while naked
    • My Tumblr
Re: Danmakufu Q&A/Problem Thread v3
« Reply #517 on: March 30, 2010, 11:03:53 PM »
Ohh, I get it. Thanks a lot. o/
Tumblr (sometimes NSFW) | PM for Facebook

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #518 on: March 30, 2010, 11:33:37 PM »
Just to clarify (even if you said you get it), you were trying to concatenate an object to an array. Technically it's just invalid because you can only concatenate two arrays. So just throw the object into a make-believe array and poof.

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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #519 on: March 31, 2010, 12:08:25 AM »
I need help with a simple Menu script.
I used "Wonderful☆Life's Introduction to Menus" as a base, but my Danmakufu keeps crashing after it told me that something is wrong with "enemy_script_main".
Code: [Select]
#?????e????
#Title[Some Title]
#Text[Some Text]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

let Selection=0;
let warning=0;
let alph1=150;
let alph2=150;
let alph3=150;
let alph4=0;
let alph5=0;
let MenuBG=GetCurrentScriptDirectory~"IMG\MenuBackground.png"
let Icon1=GetCurrentScriptDirectory~"IMG\Cirno.png"
let Icon2=GetCurrentScriptDirectory~"IMG\Daiyousei.png"
@Initialize{
LoadGraphic(MenuBG);
   SetLife(1);
}

@MainLoop{
if(GetKeyState(VK_UP) == KEY_PUSH){Selection+=1;warning=0;}
if(GetKeyState(VK_DOWN) == KEY_PUSH){Selection-=1;warning=0;}
if(GetKeyState(VK_SHOT) == KEY_PUSH && Selection==0){warning=1;}
if(GetKeyState(VK_SHOT) == KEY_PUSH && Selection==1){warning=1;}
if(GetKeyState(VK_SHOT) == KEY_PUSH && Selection==2){ClearStage;}
}

@DrawLoop{
DrawText("Idiot",GetCenterX,GetCenterY,15,alph1);
DrawText("Triple Idiot",GetCenterX,GetCenterY-20,15,alph2);
DrawText("EXIT",GetCenterX,GetCenterY-60,15,alph3);
if(Selection==0){alph1=255; alph2=150; alph3=150;}
if(Selection==1){alph1=150; alph2=255; alph3=150;}
if(Selection==2){alph1=150; alph2=150; alph3=255;}
if(Selection==0&&warning==1;){alph4=255;}else{alph4=0;}
if(Selection==1&&warning==1;){alph5=255;}else{alph5=0;}
if(Select>2){Select=2;}
if(Select<0){Select=0;}

SetTexture(Icon1);
SetGraphicRect(0,0,128,128);
SetAlpha(aplh4);
DrawGraphic(GetCenterX-64,GetCenterY);

SetTexture(Icon2);
SetGraphicRect(0,0,128,128);
SetAlpha(aplh5);
DrawGraphic(GetCenterX-64,GetCenterY-20);
}

}

I bet it is like the most simplest thing, but I was too stupid to find it.
Also yes this was only a test to see if the options on the menu would work, If so they should display a small picture on the side of the option, when chosen, and when the option was changed it would disappear again.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #520 on: March 31, 2010, 12:13:02 AM »
You script needs to start with #TouhouDanmakufu[Stage] if you're using script_stage_main. Also, enemy_script_main doesnt exist, it's script_enemy_main.

Please tab your code.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #521 on: March 31, 2010, 12:14:23 AM »
#TouhouDanmakufu[Stage]fuckgoddammit naut

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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #522 on: March 31, 2010, 12:26:43 AM »
So yeah... after fixing that... (and also some other errors) I am now with the problem that nothing appears...

I think something is wrong with the overall script.

Code: [Select]
let MenuBG=GetCurrentScriptDirectory~"IMG\MenuBackground.png";
let Baka=GetCurrentScriptDirectory~"IMG\Cirno.png";
let Baka2=GetCurrentScriptDirectory~"IMG\Daiyousei.png";
@Initialize{
LoadGraphic(MenuBG);
LoadGraphic(Baka);
LoadGraphic(Baka2);
}
[...]
@DrawLoop{

SetTexture(MenuBG);
SetGraphicRect(0,0,400,480);
SetAlpha(255);
DrawGraphic(GetCenterX,GetCenterY);

DrawText("Idiot",GetCenterX,GetCenterY,15,alph1);
DrawText("Triple Idiot",GetCenterX,GetCenterY-20,15,alph2);
DrawText("EXIT",GetCenterX,GetCenterY-60,15,alph3);
if(Selection==0){alph1=255; alph2=150; alph3=150; alph4=0; alph5=0;}
if(Selection==1){alph1=150; alph2=255; alph3=150; alph4=0; alph5=0;}
if(Selection==2){alph1=150; alph2=150; alph3=255; alph4=0; alph5=0;}
if(Selection==0&&warning==1){alph4=255}
if(Selection==1&&warning==1){alph5=255}
if(Selection>2){Selection=2}
if(Selection<0){Selection=0}

SetTexture(Baka);
SetGraphicRect(0,0,128,128);
SetAlpha(alph4);
DrawGraphic(GetCenterX-64,GetCenterY);

SetTexture(Baka2);
SetGraphicRect(0,0,128,128);
SetAlpha(alph5);
DrawGraphic(GetCenterX-64,GetCenterY-20);
}

}
I am seriously too dumb for menu scripting, I think.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #523 on: March 31, 2010, 12:38:01 AM »
Nothing appearing as in...?

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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #524 on: March 31, 2010, 12:41:48 AM »
Nothing appearing as in...?

Only Standart Danmakufu Stage Background and Player.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #525 on: March 31, 2010, 12:47:22 AM »
@DrawLoop does not work for stage scripts. You need to throw all your drawing functions in @BackGround. The reason why nothing errors is because Danmakufu just completely ignores the @DrawLoop in stage scripts.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #526 on: March 31, 2010, 12:51:41 AM »
@DrawLoop does not work for stage scripts. You need to throw all your drawing functions in @BackGround. The reason why nothing errors is because Danmakufu just completely ignores the @DrawLoop in stage scripts.

Thanks for the help.
I will be sure to not credit you for the help with the menu.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #527 on: March 31, 2010, 01:16:50 AM »
@DrawLoop does not work for stage scripts. You need to throw all your drawing functions in @BackGround. The reason why nothing errors is because Danmakufu just completely ignores the @DrawLoop in stage scripts.

How about @MainLoop?
Do effect objects work in @MainLoop?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #528 on: March 31, 2010, 02:33:24 AM »
Yes they do. When you yield out of a @MainLoop to tasks, Danmakufu still treats it as if you're still in the @MainLoop, which is why you can't draw things using DrawGraphic or anything like that in tasks. If you yield out of your @DrawLoop, you can (in enemy scripts and whatever). Same with yielding out of the @BackGround.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #529 on: March 31, 2010, 03:17:27 AM »
So uh then, what exactly does MainLoop have over DrawLoop anyways?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #530 on: March 31, 2010, 03:30:12 AM »
So uh then, what exactly does MainLoop have over DrawLoop anyways?

Spawns bullets.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #531 on: March 31, 2010, 03:39:25 AM »
I think you can still shoot bullets with the DrawLoop though...

Re: Danmakufu Q&A/Problem Thread v3
« Reply #532 on: March 31, 2010, 03:59:19 AM »
So you can. Well, @MainLoop is force ran at 60 fps. So there.

Don't make me try to justify Danmakufu's way of doing things.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #533 on: March 31, 2010, 08:40:09 AM »
Is there a way to check if the player was hit/used a bomb while LastSpell is activated and you didn't use SetScore (so there's no using GetSpellCardBonus)? OnPlayerMissed isn't working... and checking if the number of lives/bombs decreased doesn't work either... Should I make my own task for declaring LastSpell like
Code: [Select]
let playerlife=GetPlayerLife;

function HitCheck //to be called every frame in @MainLoop
{
ForbidBomb(true);
if(OnPlayerMissed==true)
{
AddLife(-GetLife);
}
}

function BonusCheck //to be called in @Finalize
{
ForbidBomb(false);
if(GetPlayerLife<playerlife)
{
ExtendPlayer(1);
return false;
}else{
return true;
}
}
Code: [Select]
@MainLoop
HitCheck;
...etc...
@Finalize
if(BonusCheck==true)
{
AddScore(blah);
}
...
wait... why did I even post this if I already thought of a workaround... guess it's me being too lazy to edit 200 notepad files :V
« Last Edit: March 31, 2010, 10:03:37 AM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Re: Danmakufu Q&A/Problem Thread v3
« Reply #534 on: March 31, 2010, 10:28:46 AM »
Is there a way to check if the player was hit/used a bomb while LastSpell is activated[...]

Wasn?t there this simple "LastSpell" function you can call in initialize?

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #535 on: March 31, 2010, 10:36:08 AM »
Wasn?t there this simple "LastSpell" function you can call in initialize?

I was using that... but apparently I can't check if the player was hit unless you use SetScore(value) then put if(GetSpellCardBonus==true) in @Finalize... but my question was... how do you check if you didn't use SetScore...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #536 on: March 31, 2010, 04:47:14 PM »
Why would you need to check for LastSpell if the pattern isn't even a card in the first place?

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

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #537 on: April 01, 2010, 02:53:44 AM »
I've got another little situation that I need help with. Basically I need to find the distance between an object and the player so that the object can behave differently when in close proximity to it.

My first attempt was ugly and would have only acted in a square around the player. There was something wrong with it, though,  and it seemed like too much of a hassle to try and fix. Next, I tried looking for a function that could just find the distance for me, to no avail. Then I realized that I could just make my own using the distance formula (hooray for geometry) but I don't know how to tell danmakufu to find the square root of a number. (I'm assuming that ^ will work for exponents.)

If someone knows how to do that, or a function that I overlooked, some insight would be much appreciated.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #538 on: April 02, 2010, 03:28:25 AM »
Why would you need to check for LastSpell if the pattern isn't even a card in the first place?

I made my own Score function... so yeah... it's a card... just... danmakufu doesn't think it is :V

I've got another little situation that I need help with. Basically I need to find the distance between an object and the player so that the object can behave differently when in close proximity to it.

My first attempt was ugly and would have only acted in a square around the player. There was something wrong with it, though,  and it seemed like too much of a hassle to try and fix. Next, I tried looking for a function that could just find the distance for me, to no avail. Then I realized that I could just make my own using the distance formula (hooray for geometry) but I don't know how to tell danmakufu to find the square root of a number. (I'm assuming that ^ will work for exponents.)

If someone knows how to do that, or a function that I overlooked, some insight would be much appreciated.

^0.5 raised to the 0.5 is the same as getting the square root...

It's so nice to have MotK back :V
« Last Edit: April 02, 2010, 03:35:39 AM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #539 on: April 02, 2010, 03:58:44 AM »
 :o I didn't know that. Wow...

Thanks a bunch. That will definitely be a useful tidbit to know from now on...