Main Menu
  • Welcome to The RPG Maker Resource Kit.

Programming/Maths Problem

Started by ahref, July 29, 2011, 11:18:41 PM

0 Members and 1 Guest are viewing this topic.

ahref

Hi,

Was wondering if anyone could help me with a mathsy programmy problem. Its been driving me nuts:

Given an infinite number of colums, where odd numbered columns have x cells and even numbered columns have y cells. Each cell can hold one object, how do i figure out the column number of the nth item.

For further clarification and example;
x = 4
y = 3


At the moment i do some stupid while loop to work this out, Id love it if there was a one liner, or simple maths formula. Speed is essential here :(

Thanks for your help guys :)

Night_Runner

K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

ahref

How the hell did you figure that out :D?