WML to do integer divide on a variable
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
WML to do integer divide on a variable
I think there is no way to find out if you can divide a variable and a number without fraction stuff comes out.
I invented a macro for this. I don´t know sure if it would work..

I invented a macro for this. I don´t know sure if it would work..

Code: Select all
#define CHECK_DIVIDE VAR ARG LIMIT
{VARIABLE_OP {VAR} divide {ARG}}
[while]
[variable]
name=divide
equals=no
[/variable]
[do]
[if]
[variable]
name=number
numerical_equals=${VAR}
[/variable]
[then]
{VARIABLE dividable yes}
{VARIABLE divide yes}
[/then]
[else]
{VARIABLE_OP number add 1}
[if]
[variable]
name=number
numerical_equals={LIMIT}
[/variable] #when this has no limit
and the number is not divideable, then the computer won´t get out of the loop!
[then]
{VARIABLE divide yes}
{VARIABL dividable no} #this stops the repeat
[/then]
[/if]
[/else]
[/if]
[/do]
[/while]

Last edited by toms on March 9th, 2006, 3:07 pm, edited 1 time in total.
First read, then think. Read again, think again. And then post!
So, basically, this macro divides a number and gives rounds the answer down? i.e., 9/4 -> 2, not 2.25?
What's the point of this? How would it be used?...
What's the point of this? How would it be used?...
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
No. It checks if you can do integer divide (I found the name
) without rests with a variable by using a number you can choose.
Example: It says that 9/4 "cannot" be divided, and 8/4 could.
And the use...
. I thought before that I need this, but I don´t and at this time, I didn´t had this idea. Maybe another guy can use it. 

Example: It says that 9/4 "cannot" be divided, and 8/4 could.
And the use...


First read, then think. Read again, think again. And then post!