Giter Site home page Giter Site logo

Comments (8)

yrsegal avatar yrsegal commented on August 16, 2024

Most trick powers require a number constant.

from psi.

DaedalusGame avatar DaedalusGame commented on August 16, 2024

modulo and then integer division might be what you want, say you want to run it every 5th step
(1 mod 5) / 4 = 0
(4 mod 5) / 4 = 1
(5 mod 5) / 4 = 0
(6 mod 5) / 4 = 0
etc
(fixed because apparently i do not understand 10th grade math)

Also motion to not make tricks require constants
Or maybe have a piece that doesn't pass further down it's path if it doesn't receive a number > 0 or another type != null?
(I don't actually know how spells evaluate in this)

from psi.

yrsegal avatar yrsegal commented on August 16, 2024

tricks need constants because that's how cost is determined

from psi.

DaedalusGame avatar DaedalusGame commented on August 16, 2024

yeah but tricks have other inputs apart from the constant. There's probably very hacky ways to make conditionals work.
Also some tricks take a constant max for cost determination and a variable parameter for level of actual performance.

from psi.

sharenohana avatar sharenohana commented on August 16, 2024

It's totally doable. I've found a few "hacky" ways to do conditionals, but the easiest way is one you're already on track for. After using modulo to make the value 1 only when you want it to run, put the result through an inverse function. 1^-1 is 1, but 0^-1 is a divide by zero error. Then just feed that inverse function into the spell somewhere to crash it. The easiest way is just to multiply something by it, like a vector or other number that the spell uses. The error will follow down the line to the trick, and crash the spell.

As an added bonus, you can crash one trick in a spell, while making another trick still work. The spell compiler reads left to right, top to bottom, so as long as the trick you're crashing comes after the trick you want to work, the spell will cast the first part.

If you want to see an example of some of this stuff in action, check out my flight spell on /r/psispellcompendium. [link]

from psi.

Vazkii avatar Vazkii commented on August 16, 2024

Booleans and conditionals are not in the plans, as I don't want to make Psi a fully fledged "visual programming" system, but rather a simple sequence of actions. What I have in mind is a "Trick: Die" of sorts, which will take a Number parameter and stop the spell execution if it's between 0 and 1 (exclusive).

If that sounds finicky, that's because it is. I like throwing wrenches into your plans.

from psi.

mfriendc avatar mfriendc commented on August 16, 2024

this is not flow control, it's just flow stoppage

from psi.

Vazkii avatar Vazkii commented on August 16, 2024

image

from psi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.