Space Engineers

Space Engineers

XPAR Mimir (OBSOLETE)
Using Mimir to replace complex Timer structures(Timer bools, Timer delay emulation)
So far I love this thing, but i've hit my first quandry. I use some of the timer's on and off states as bools and mode switches (turn one off and another on to change behaviors and break from a loop)

Can Logic be called from the Cached Commands? Same with setting variables.

Likewise is there a way for logic to call a cached command?

if so this thing will be able to replace ALL of my timres
< >
Zobrazeno 113 z 13 komentářů
Except the Heartbeat of course
Craig P  [vývojář] 11. čvc. 2015 v 6.32 
You can use the line

Apply("Some Cached Command")

in the logic or UI function, it'll work fine. In fact, you can call cached commands from within cached commands.

But calling logic or UI functions from within a cached command is a serious recursion risk - what are you trying to do? There's probably a better way to do it.

To set an arbitrary boolean, use

Set("Arbitrary boolean of any name") in the code, or
"Set(Arbitrary boolean of any name)" in a cached command/run call argument

Use UnSet to clear it.

You can check the state of them in the UI or logic functions using IsSet.

Right now, there is no way to check a value in a cached command/run call argument, because I don't know how that would work.
I think i worked it out, on pen and paper

If (IsSet(triggerbool)) // emulates Trigger Now;
{
If (IsSet(BehaviorA-On); //Behavior A looks for more rock to mine, Continuing Mining Loop
{
Apply(CachedcommandA;
Unset(triggerbool):
}
Else If (IsSet(BehaviorB-On); //Behavior B Initiates the return home, Breaking out of the mining loop
{
Apply(CachedcommandB);
Unset(triggerbool):
}

And let the cached commands set to "On" bools
Craig P  [vývojář] 11. čvc. 2015 v 7.25 
Yeah, the logic's right.
That's a relief, this is the first time I've really tried to put together any kind of code in over 10 years, even if it's simplified by mimir. That and the last thing I coded in was TiBASIC, so this is completely different. Though if it were TiBASIC I'd probably have this thing doing a victory dance by now, LOL
Craig P  [vývojář] 11. čvc. 2015 v 7.46 
If it's been a while, I really, really recommend using Scite or Visual Studio or MonoDevelop. You don't want a clumsy " or : to stymie you.
I'm getting "Name does Not exist in this context" errors when trying to use "if (IsSet(name))" in custom logic
Craig P  [vývojář] 11. čvc. 2015 v 11.27 
Yeah, if it's in code, you need to pass a string:

if (IsSet("Name"))
can u suggest me a way to lock landing gears when a connector is locked and unlock them when it's unlocked plz?
Craig P  [vývojář] 13. čvc. 2015 v 11.20 
@Mars: Well, that depends on whether those blocks have functioning isLocked properties. They're specified in the code, but I haven't tried them. I'll try them tonight and report back.
Craig P  [vývojář] 13. čvc. 2015 v 13.26 
@Mars: OK, check the "snippets" discussion, and make sure to use the version of Mimir I just released.
Ok thanks!
Can I use custom names for landing gears with that code? Or it affect all the landing gears?
Thanks again
Craig P  [vývojář] 14. čvc. 2015 v 6.13 
That code affects all things with "Gear" in the name: "*Gear". If you want, you can name specific landing gear by removing the star, or use different key words.
< >
Zobrazeno 113 z 13 komentářů
Na stránku: 1530 50