Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
how to debug visual-scripting?

veganpete.
Registered User
Quote
2024-03-20 21:02:52

I've asked a similar question a few years ago with no solution other than "learn to code". I actually agree, but wondered if anyone has since figured out a way to view the ccb/exe visual-scripting in a plain-text file or similar?

Maybe there's a decompiler now that can see the user's built-in coppercube c+ or javascript visual-coded actions?

I've decided to remake the "saboteur" game again (from scratch, without scripting). It's going really well, but - whenever I make progress in creating a 'non-code' game, it eventually becomes impossible to click through the hundreds (thousands?) of actions, trying to view them in the tiny, 2-line window. At that point, it becomes extremely difficult to make any further progress.

Trying to manually write it all down, in a text-file, has proven to be even more difficult/time consuming than using the coppercube editor directly - especially as frequent edits are being made each hour. I'd say it's actually impossible to do.

There's one bug in my game at the moment, I know what's causing it (it's a duplicate action somewhere) - but I can't find it to fix it/delete it.

I tried a hex editor but can't see anything readable - is there a better method I've not thought of?

At this stage, I'm open to any suggestions at all - if I ever figure out anything helpful, I'll post it here.

Many thanks.


Guest
Guest
Quote
2024-03-20 23:02:19

I'd love to look through that text document you mention if you still have it. I could then program some custom extensions to alleviate some of your headache by examining patterns in your workflow. It'd be a fun project. Let me know.


vp
Guest
Quote
2024-03-20 23:45:51

Thanks.

My workflow is fairly logical - each of my projects consist of 3 main things..

1- variables, used to define states.
2- conditions, to define the actions if /when those states are met.
3- every-few-second loops to continually check if the conditions are met....

Works really well. Here's the game so far (issue I'm having is the climb-idle sprite - single-frame - is flickering. looks like it's resizing)...It was working perfectly until my last edit, when I must have changed something without noticing. I'll be able to fix it - that's not the issue. The issue is that it will take many hours of clicking, just to find a simple error. As the game progresses and get larger, the inevitable clicking time gets exponentially longer - just need a way to actually see things on-screen at once, rather than a click-at-a-time.

https://veganpete.itch.io/2d-pla...

The *new download is the one with my latest non-code/visual-scripting version,

The *old download is using just_in_case's 2d camera and 2d controller plugins.

Here are my initial text notes from last week, before I started making it (*it has mistakes but the game now contains a much revised/longer version with the mistakes fixed). I have 4 of these kind of things running in the game, to control the character movement/sprite-animations/keys/camera etc...

GROUND, IDLE, WALK, CROUCH, JUMP, FALL, CLIMB, CLIMBUP, CLIMBDOWN, W, A, S, D, SPACE, FALLTIMER.

IDLE1:
if "w" =0,
if "a" =0,
if "s" =0,
if "d" =0,
if "ground" =1,
if "walk" =0
if "crouch" =0,
if "jump" =0,
if "fall" =0,
if "climb" =0
set "idle" =1.
____________________________________

IDLE0:
if "ground" =0
set "idle" =0

IDLE0:
if "walk" =1
set "idle" =0

IDLE0:
if "crouch" =1
set "idle" =0

IDLE0:
if "jump" =1
set "idle" =0

IDLE0:
if "fall" =1
set "idle" =0

IDLE0:
if "climb" =1
set "idle" =0
____________________________________

WALK0:
if "a" =1,
if "d" =1,
set "walk" =0.

WALK0:
if "a" =0,
if "d" =0,
set "walk" =0.

WALK0:
if "idle" = 1,
set "walk" =0.

WALK0:
if "crouch" = 1,
set "walk" =0.

WALK0:
if "jump" = 1,
set "walk" =0.

WALK0:
if "fall" = 1,
set "walk" =0.

WALK0:
if "climb" =1,
set "walk" =0.

____________________________________

WALK1:
if "a" =1,
if "d" =0,
if "jump" =0,
if "fall" =0,
if "climb" =0
set "walk" =1.

WALK1:
if "a" =0,
if "d" =1,
if "jump" =0,
if "fall" =0,
if "climb" =0,
set "walk" =1.
____________________________________

JUMP1:
if "spacereset" =0
if "ground" =0,
if "crouch" =0
if fall =0,
if climb =0,
set "jump" =1.
____________________________________

JUMP0:
if "fall" =1
set "jump" =0

JUMP0:
if "climb" =1
set "jump" =0
____________________________________

FALL1:
if ground =0,
if "falltimer" >14,
set "fall" =1
____________________________________

CLIMB1:
if "ladder" =1,
if "climbup" =1,
set "climb" =1

CLIMB1:
if "ladder" =1,
if "climbdown" =1,
set "climb" =1
____________________________________

CLIMB0:
if "climbup" =0,
if "climbdown" =0,
set "climb" =0
____________________________________

CLIMBUP:
if "ladder" =1,
if "w" =1,
if "fall" =0,
if jump =0,
set "climbup" =1
____________________________________

CLIMBDOWN:
if "ladder"


vp
Guest
Quote
2024-03-21 00:35:58

well...took quite a few hours, but finally fixed the issue! - it was 2 copies of the same action - one scaling sprite to 1.4,1,1.4 and the second copy scaling it to 1.5,1,1.5 at the same time.

To make bug-hunting quicker in the future, I wonder if there's a way to force the coppercube GUI to scale-up/down (massively) so that everything can fit on screen at once? I could then screen-shot everything and then possibly use an OCR scanner to convert it all to plain-text - maybe I'm overthinking it.


Guest
Guest
Quote
2024-03-21 01:07:26

Ok so I assume you're using the "If a variable has a value do something" with these and nesting them? So this one for example:

IDLE1:
if "w" =0,
if "a" =0,
if "s" =0,
if "d" =0,
if "ground" =1,
if "walk" =0
if "crouch" =0,
if "jump" =0,
if "fall" =0,
if "climb" =0
set "idle" =1.

You are running this in an "Every few seconds do something" with the action being a chain of "If a variable has a value do something" actions nested inside one another? No wonder you are having problems if that is so. I'll program something for you to test out, and we can make adjustments as needed. I've got a couple ideas but this might take a couple tries to get right.


Guest
Guest
Quote
2024-03-21 03:10:20

Okay, so here's my first crack at the problem. I call this action the "Conditional Action Executor" for want of a better name. It evaluates up to 10 conditions. It uses CC's operators: =, <>, <, >. The condition must be in a 3-part form. Valid examples include: a = 1 (is-equals), a <> 0 (not-equal), a > 0 (greater-than), a < 2 (less-than), etc. This can be extended by including more conditions, adding JS's operators, utilizing JS's comparisons (&&, ||, etc.), using multiple variables in a condition ({a} = {b}, {a} || {b}, etc.), and so on. You can also nest this action inside itself if you find yourself needing to do so. I just didn't want to overcomplicate the action too much. I'm willing to make changes to suit whatever you need. Good luck on your project.

https://files.catbox.moe/y6g14g....


Guest
Guest
Quote
2024-03-21 03:17:12

Failed to mention it also works with strings like: light = on, light = off. Any valid CC variable/value should work. It could even be made to work with JS's arrays. Sky is the limit.


vp
Guest
Quote
2024-03-21 08:16:15

Sorry for the late reply, yes, you understood my issue correctly.

As for the action you've made, it's absolutely amazing and perfect! for my needs. I appreciate this immensely!

Thanks for making this GUEST, words can't quite express how happy this has made me - it will truly help me endlessly with copercube.

The layout is such that I can see what's happening instantly, and being able to nest multiple instances, inside itself, will keep everything neat and very quick to control/check/test/edit etc..

It'll also help me to clean-up the parts of my game which I knew were sub-optimal, but were too awkward to attempt change.

I'll spend today swapping over all the parts of my game to use your action.

One thing extra, if I may ask - do you know if there's a way for me to add some kind of title/header to the conditions please? (No problem at all if not).

eg:
condition0: //Walk-left-blah-blah// a = 1, s = 0

Super happy!
Thank you so much! You're a shining star.


vp
Guest
Quote
2024-03-21 09:46:43

Sorry to ask Guest...one last thing, if I may...

would you mind adding an <else> condition to your action please?

<condition0>
<action0>
<else0>

Thank you so much!


Guest
Guest
Quote
2024-03-21 10:04:55

The best way to take notes on your actions is by using an Execute JS action. The other ways I know are buggy and will cause issues. You simply use valid JS comments inside the action like this:

// This is a single line comment.

/*
This
is
a
multiline
comment.
*/

The second choice is preferable for writing the most and gives the most freedom. I'm glad you liked the action. Let me know if you find any bugs or need anything else. Cheers!


vp
Guest
Quote
2024-03-21 10:26:03

That's great - I'll add notes using a header in a script. Thank you!

one last thing - would you mind adding an <else> condition to your action, if possible, please?

<condition0>
<action0>
<else0>

Thank you so much!


Guest
Guest
Quote
2024-03-21 10:29:10

Here's the link for the updated action with the else. I only had time to set a cube visible or not with it but it seemed to work just fine. Let me know if I missed anything else. You're welcome!

https://files.catbox.moe/xjt4p7....


Guest
Guest
Quote
2024-03-22 22:31:35

Made another action extension called CopperCubeVariableSetter. This one can set a 100 or less CC variables of type int, float, string in one action. It accepts long strings as well. Examples: a = 10, b = 3.0, c = hello, etc. It can also take c = 'hello' or c = "hello" or c = "Hello, World!". I also updated the ConditionActionExecutor to accept long strings. The goal of these extensions is to keep the user up the scene graph as much as is reasonably possible. Hopefully you or someone else finds them useful. Let me know if you spot any bugs should you decide to use them. Cheers.

https://files.catbox.moe/mkayzl....


vp
Guest
Quote
2024-03-25 12:59:07

Wow, these are awesome plugins GUEST!

I'm using the conditional event plugin, it's really great! The 'variables' one will be super useful too. Congrats on making these. I'll be using these all the time from now on.

One wish (although I don't think it's possible) - both of these plugins would benefit from an '+ add more' button, to add an extra slot to the action each time it's clicked; rather than having a predefined limit of 10 conditions or 100 variables. Not sure if the API allows for that to be done.

🔎︎


By the way, do you accept financial donations?

Thanks again for making these invaluable plugins!!


Guest
Guest
Quote
2024-03-26 00:08:36

Unfortunately, it's not possible to access the editor's source code as it's closed. However, I've prepared a version of the ConditionActionExecutor that contains 100 conditions, actions, and else statements, similar to the CopperCubeVariableSetter:

https://files.catbox.moe/wd2sdz....

Tonight, I plan to develop a key event behavior that consolidates all key inputs to simplify handling simple logic. Please let me know if you encounter any bugs in the provided code or if you have any suggestions for improving CopperCube's visual scripting. Your offer of donation is appreciated, but simply being helpful is rewarding enough. Consider donating to a good cause instead. Thank you and cheers!


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact