Math Functions

Merrie
I might be blind as a bat :) or perhaps Im not looking in the right area, but I was reading through the manual. Are there common math fuctions like + - / * ?

Thanks!

007bond
I know someone tried to create a math library, but that was years ago.
I think it was Tr0n or GameBoy, not sure.

Speaking of libraries, what happened to MaDbRiT and his TypeLib?

Alex
Yes, you can use common math functions.

You can enter any expression when setting the contents of a numeric variable, e.g.

2 + 2
3 * %something%
(%num% + 3) / 4

You can also enter a mathematical expression in any parameter by enclosing it with { braces }. For example, in a "Print a message" script, you can type:


You are carrying %beans% magic beans. If you buy 3 buckets, you will have { %beans% - (3 * #bucket:cost#) } left.

paul_one
Oooo, very VERY nice!

Elexxorine
Is that one of the new features?

Alex
Yes, that's new in Quest 4.0.

I can recommend taking a look at http://www.axeuk.com/quest/developer/do ... pgrade.htm and also VERSIONS.TXT...

Elexxorine
Thanks. I haven't actually been using version 4, sticking to the old version until my game's finished... lol.

MaDbRiT
007 Bond asked;

Speaking of libraries, what happened to MaDbRiT and his TypeLib?



Well I'm still here, my typelib (as it was) was intended to provide functionality which was missing in Quest 3, a lot of which is now included in Quest 4, so large chunks of it are redundant.

I'm not in the least distressed by that, the fact many functions my typelib provided are now integral to Quest sort of proves that it served a purpose. :-)

I do have a (shelved presently) new typelib that does 'lots of other stuff' that I've mentioned on here in the past. However as the #1 collaborator, tester and user of my code (and story-writer) is currently very tied up with 'real life'TM (she has a new baby to contend with!) My Quest activities are reduced to 'interested bystander'.

I'm also playing about with the other I-F engines, and I must admit that were I to write a game 'solo' I'd probably choose to use one of these as I'd be doing a 'strictly text' approach to allow running on other platforms than Windows.

Al (MaDbRiT)

steve the gaming guy
Alex wrote:Yes, you can use common math functions.

You can enter any expression when setting the contents of a numeric variable, e.g.

2 + 2
3 * %something%
(%num% + 3) / 4

You can also enter a mathematical expression in any parameter by enclosing it with { braces }. For example, in a "Print a message" script, you can type:


You are carrying %beans% magic beans. If you buy 3 buckets, you will have { %beans% - (3 * #bucket:cost#) } left.


Very cool....even though I'm not a 100% programmer-thinking type. This is pointless but I was curious. In your example, what does the "cost" do?

Alex
"cost" is a property of the "bucket" object in that example.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums