Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Help! Using zazz and dd modules at the same time

A topic by Felix Rios created Mar 23, 2025 Views: 162 Replies: 4
Viewing posts 1 to 4

I am trying to have a wave animation using zazz, but at the same time I want to play a loop sound, as well as display a dialogue using Visual Novel Modals (dd). But since the zazz wave animation needs me to loop the card script. How do I manage this without executing every part of the script infinitely?

on view do
 play["bus_sound" "loop"]
 dd.open[deck]
 dd.say["The first message."]
 dd.say["The second message."]
 dd.close[]
 zazz.wave[card wave_bus 0.002]
 go[card]
end
(+2)

I'm assuming you only want the dialog to appear one time when the player gets to the card.


One way to do it is to put the "one time only" part of the script into an If statement, which checks some condition to see whether or not to play the scene and then modifies the condition once it's done.

In this case, I'm using a checkbox on the card named 'arriving' -- You can set a button to be a 'checkbox' in it's properties menu. Checkboxes either have a value (marked/True) or nothing (unmarked/False).

on view do
 if arriving.value # looks to see if the checkbox is True #
   dd.open[deck]
   dd.say["The first message."]
   dd.say["The second message."]
   dd.close[]
   arriving.value:0 #sets the checkbox to False so the scene doesn't repeat #
 end # the 'end' for the If statement #
play["bus sound" "loop"]
zazz.wave[card wave_bus 0.002]
go[card]
end

But we also need to make sure the checkbox is True when it needs to be.

On the script (whether in a button or not) that led to this card you can add

NameOfBusWaveCard.widgets.arriving.value:1

before the

go["NameOfBusWaveCard"]

to make sure the checkbox is marked True before the player gets there. Replace "NameOfBusWaveCard" with the actual name. :) And if you like how everything works, you can set this "arriving" widget's visibility to "None" to hide it from your user.

Hopefully this gives you a tool for setting things up how you want them! Please let me know if you need something else and I'll make a different example.

Developer(+2)

The key idea here is that the functions provided by zazz need to be called repeatedly in order to drive animation, while dialogizer dialog boxes make script execution wait until they're dismissed.

In a fragment like

on view do
 zazz.wave[card wave_bus 0.002]
 go[card]
end

The "go[card]" statement at the end is telling Decker to send another view[] event to the card on the next frame, so zazz.wave[] gets called 60 times per second.

As noted in the documentation, while a dialogizer dialog box is open and dialogizer is internally waiting for the user to click the mouse, it continuously sends animate[] events to the current card. You could reorganize your script to separate out the "one-off" and "repeated" parts like so:

on view do
 play["bus_sound" "loop"]
 dd.open[deck]
 dd.say["The first message."]
 dd.say["The second message."]
 dd.close[]
end
on animate do
 zazz.wave[card wave_bus 0.002]
end

But note that animate[] won't be automatically called by Decker when a dialog box isn't open; it's just a convention made up by dialogizer!

A simple way around this might be to make one of the widgets on your card "animated" (Widgets -> Animated), which will ask Decker to send that widget a view[] event once per frame, so long as no other scripts are blocking it. You can then route that widget's view[] event to "pump" the surrounding card's animate[] handler by giving it a script like

on view do
 animate[]
end

And remember: you only need one "animation pump" like this per card! If you have a whole bunch of animated widgets routing animate[] to the card, you'll end up doing lots of invisible, unnecessary work!

Does that make sense?

(+2)

This made the trick! Thanks!

(+2)

You guys are too good! Thaanks a lot!!!