about the isStargateDialingOut cc method
C4PTRAMPAGE opened this issue ยท 14 comments
yes, it should always return bool
true if stargate is connected and it is outgoing connection = this gate dialed = it is safe to enter
false otherwise
Edit:
wiki:
Returns true if the Stargate is currently dialing out, otherwise (if Stargate isn't connected or the connection is incoming) returns false.
nice UI btw
thanks,
the reason i ask in that isStargateDialingOut would be a lot more useful if it could return false if >= 1 chevrons are active so that an alarm or other security that needs to be activated before the wormhole is established has time to do so and if it returned nil if no chevrons were active it'd help with checks as well
so you are looking for getChevronsEngaged()
?
but yes I agree, there is no "absolute" way how at specific moment in time say, if chevrons are engaged for incomming or outgoing (not yet formed) connection
but you can do that with events & recent feedback
but yes I agree, there is no "absolute" way how at specific moment in time say, if chevrons are engaged for incomming or outgoing (not yet formed) connection
There is stargate_chevron_engaged Event
the reason i ask in that isStargateDialingOut would be a lot more useful if it could return false if >= 1 chevrons are active so that an alarm or other security that needs to be activated before the wormhole is established has time to do so and if it returned nil if no chevrons were active it'd help with checks as well
I hate returning null values because it often causes problems when something breaks (look no further than Java's infamous NullPointerException). If there was a function like that, it would 10 000 000 000% return numbers and NEVER nil.
the problem with the chevron engaged event is that (possibly due to my bad coding, so my fault not yours) the script doesn't always notice events reliably, though a lot more with mouse clicks than anything else, no idea why.
to be clear the program does work as intended, its just a bit unresponsive to mouse clicks and rarely skips other events.
the problem with the chevron engaged event is that (possibly due to my bad coding, so my fault not yours) the script doesn't always notice events reliably, though a lot more with mouse clicks than anything else, no idea why.
to be clear the program does work as intended, its just a bit unresponsive to mouse clicks and rarely skips other events.
That is probably a problem in your event handling, note that using sleep and other similar functions, purges the event queue of the current coroutine, you can join SGJourney discord and consult your program with the community.
sleep clears events? don't think i'm using sleep much but i'll look, i assumed it was the 10 trillion if then statements in the doing stuff part of the code or the math for updating stuff on the screen.
...wait do timer evens clear other events? i'm using that to stop the script from pausing too long while it looks for other events, so the code can actually do stuff.
anyway maybe i'll join that discord but i doubt anyone would be willing to look through almost 4000 lines of spaghetti code total across 7 files that load each other with require.
sleep clears events? don't think i'm using sleep much but i'll look, i assumed it was the 10 trillion if then statements in the doing stuff part of the code or the math for updating stuff on the screen.
...wait do timer evens clear other events? i'm using that to stop the script from pausing too long while it looks for other events, so the code can actually do stuff.
anyway maybe i'll join that discord but i doubt anyone would be willing to look through almost 4000 lines of spaghetti code total across 7 files that load each other with require.
I can try maybe ๐
I don't know what you mean by "stopping the script from pausing too long" so I guess it depends how you process events from timer.
Eventually you can look at my code, which also works with events and I don't think I'm losing any events, but it's not well written either.
I solved the problems with sleep (which purged events) with something I called "run later", which is basically a separate coroutine/"thread" that has a queue of lambdas with timeouts, the "thread" checks the timeout and executes them when the timeout is exceeded. So I changed the problem from "stop the current thread for X seconds" to "give a function to another thread that will execute it after X seconds", it has its drawbacks, but the current "thread" keeps its events and the other one only takes care of timers and cleaning other events is not a problem there.
Where'd you get that graphical DHD program. The Comptuer Craft stuff on Povstalec's Repos' haven't been updated since January, and C4P doesn't seem to have any Repos and from first appearance, it seems like he made it, yet doesn't have a github for hit, how... confusing.
Where'd you get that graphical DHD program. The Comptuer Craft stuff on Povstalec's Repos' haven't been updated since January, and C4P doesn't seem to have any Repos and from first appearance, it seems like he made it, yet doesn't have a github for hit, how... confusing.
There's a bunch of people on the Discord server that share their Dialing programs in the #creations channel
thanks,
the reason i ask in that isStargateDialingOut would be a lot more useful if it could return false if >= 1 chevrons are active so that an alarm or other security that needs to be activated before the wormhole is established has time to do so and if it returned nil if no chevrons were active it'd help with checks as well
Actually, what's the problem with using isStargateConnected() instead? You can pair that with isStargateDialingOut() and with those two functions you could pretty much just do what you want if I understood you correctly.
Either way, I'm also adding isWormholeOpen(), so that you can get more specific.
sorry for the late reply on this everyone
C4P doesn't seem to have any Repos and from first appearance, it seems like he made it, yet doesn't have a github for hit, how... confusing.
i didn't release it anywhere because the file save system isn't finalized yet and i don't want to break anyone's address book, yeah WE could figure out how to get the addresses back by looking at the files but there are people who use pre-made cc scripts but don't know much else and i don't want people to get reliant on this and then i may have to make a breaking change, also i haven't fixed up the event handler and it misses half the events so its not that great of a user experience yet.
Actually, what's the problem with using isStargateConnected() instead? You can pair that with isStargateDialingOut() and with those two functions you could pretty much just do what you want if I understood you correctly.
sorry i misunderstood how isStargateConnected() works; for incoming connections it returns true as soon as the local gate starts dialing back to the origin, i thought the way it worked was that it only returned true once the local gates last chev engaged, my bad.