Hey Fet, I can point out a few things for you that I can see right away that would cause some errors, though in order to make it work for what you need, I'm not sure I can help unless you post how, where, and when you're calling the function.
+ First off, the "X" function variable isn't being used. Is it suppose to be, and/or why? If your not calling the function as
Money1(integer#), then just delete it.
+ The first loop for
i=1j=1through10, you load images and create sprites
20-110. This will cause an error to occur, as in image/sprite already exist because on the next loop,
i=2 j=1through10, you attempt to load and create images/sprites
30-120, that means 8 already exist. This would continue for each loop as you'll have 8 duplicates each loop until it's complete.
+ The variable
Money is used in your function, you may be getting an error here for either you haven't declared the variable as a
Global, or if not, you need to add the variable to your function so when you call it you'll need to input the variable you want the function to use. Example:
Declare Function:
function Money1(m#)
if Fmod(m#,10^i)=j then SetSpritePosition(j+i*10,100,0+i*50)
endfunction
Call Function:
edit: this function obviously won't compile and work, it's just an example of how to edit your function code for those specific lines of code and how you'd call the function in order for it to use the variable.
+ Last thing I can point out without seeing the rest of your code that uses this function..when setting the sprite position you're using
100 for
x and
0+i*50 for
y. This will cause the first ten sprites to stack on top of each other
50 units from the top. The next
10 will be stacked
100 units from the top(hoping your using pixels and not the percentage system or the rest of the sprites will be off screen). Next
10 will be
150 units from top, than next
200, than
250...ect, ect...
If we can see more code, where this function is used and how, I'm sure myself or others can help you get a simple function working. While you do that and wait for a response, look in the help files how to create
User Defined Types , located under
Principles. This will come in handy when getting a working function together, as well as keeping your code clean, easy to read and later debug if necessary.