is it possible to combine GDscript and VisualScript together ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nico_fr

I would like to combine VISUAL SCRIPT with existing parts of GDscript. (and also the other way round)
do you know if this is feasible or recomended, and how :

  • is there a visual script node that allows to insert a whole gdscript in it ?
  • can we call a visal script within a gdscript ?
  • or do we need to for instance to use visual script on one scene, and gdscript on other scenes ?
  • or is there any other way to do ?
  • or finaly is it best to avoid mixing the two in the same game ?

thanks and best regards

:bust_in_silhouette: Reply From: kidscancode

GDScript and VS can coexist just fine. A node with a .vs attached can call a function on a node with a .gd attached. Complex things are probably better done in GD, then you can call the functions from VS to build your logic.

Experiment and see what works for you!

Ok. thanks for that answer.
I will try it out.

I also had read about the visual node “Expression” which is supposed to accept one gdscript instruction if I understood right. but I couldn’t make it work… (for instance with OS.get_time()[“second”] ) do you have any useful information on this Expression node ?

Nico_fr | 2018-03-13 15:44