Integer division

thierry_st_malo
Hi, all !

I have this code, both HHMM and HH being integers.

game.HHMM = 600
game .HH = game.HHMM \ 60

game.HH should be 10, right ? Well, no it is 0. How come ? Thanks,

Thierry

The Pixie
You are using a backslash, when I do that, Quest just complains. Using a forward slash, it behaes as expected for me.

HegemonKhan
as Pixie already answered, you just used the wrong character/symbol
(it is very easy to get the forward slash and backslash confused)

Addition: +
Subtraction: -
Multiplication: *
Division (normal division: finding the quotient): /
Modulus (division, but finding the remainder): %

so it should be this:

game.HHMM = 600
game.HH = game.HHMM / 60
// game.HH = 10

also, at least in your post, you got a space in it: game(space).HH, which if it's also in your actual game code, will likely cause it to not work as well, so delete the space out, so that there's no space between the 'e' (in game) and the '.'

------

'/' is known as the 'forward slash' character/symbol, and almost always division operation. It is also used for folder/file/url pathing. Also, '//' (two forward slashes) is used for commenting in quest.

in programming languages and quest, the backslash '\' character/symbol is known as the 'escape' character/symbol, it is used to tell the software that you want the next character/symbol to be seen/read/outputted as text (string value).

thierry_st_malo
Thanks to you both. I believed that in Quest the backslash could be used for integer division as it is in other programming languages, and of course sorry for my typing error. Actually, what started it all was the debugger's update logic, which looks a little surprising to me.

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

Support

Forums