EntityByGeomID code not working

About advanced scenes, and the Thyme scripting language used in Algodoo.

EntityByGeomID code not working

Postby FRA32 » Sat Mar 16, 2019 12:57 am

I finally have a solid idea for a scene that I have been working on lately, inspired by Juicicle's boss fight scenes. In my scene, there will be a boss consisting of multiple entities that each have unique scripts communicating with each other. Amongst these entities I have laser drones, aiming at the player for some time before shooting a high-velocity bullet. This is where my troubles arose:

Due to the drones having a laser indicating when it will shoot, I had to code the laser and the drone geometry and "bridge" them with EntityByGeomID.

What the script should be doing:
Upon reaching the timer-related condition, change the color to red and set _override of the drone base to 1. The drone base successfully stops tracking the player after that(This has been tested and confirmed, the drone base's scripts are functionals).

What it actually does:
It only changes the laser's color to red, but does not send the _override change to the base.

I did some extensive debugging and pin-pointing of where I went wrong, and came to the conclusion that there is no errors in my script. Here is some of the evidence that lead me towards this conclusion:

The Script I am using regarding the EntityByGeomID is near-identical to one I use in a different scene, which works
The Script, when placed inside a test-laser, works successfully.
The laser, when placed on a test-object, does not work, however cutting the important script out of the code and into the object console WORKS given a specific adjustment(see below for elaboration)
The colorhsva script directly below it executes successfully, despite entityByGeomID failing.

The "specific adjustment" that I mentioned is something highly curious which I do not quite understand. Merely pasting the code from the if-condition into the console does not work, but typing "test = {*code*};test" into the console(basically wrapping the code in a variable first) DOES seem to work. I think this outlines the wierdness of the situation. I'd like to note that wrapping the code in a variable does not fix the issue of it malfunctioning outside the console

Since I would really like to finish a scene for once and really need the laser-drone communication, I decided to ask you if you might be able to find the cause of this, and perhaps also present a fix for it. A variation of my boss scene(vastly reduced to ease debugging) has been attached and the "importand code" inside the lasers poststep has been marked with readme's.
Attachments
Malfunction.phz
(22.69 KiB) Downloaded 304 times
FRA32
 
Posts: 227
Joined: Wed Dec 03, 2014 9:51 pm

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests

cron