Jump to content

Random move


Shides
 Share

Recommended Posts

  • Moderators

Hi which string it allows a random movement of some images?

Thank's

Excuse me for english but i'm italian :">

Random() ... That's as much as I understood your question.

The rest will have to be written by you yourself... if the images are in a GUI you may look at ControlMove() if they are in files, you may look at FileMove(), if this has no relevance, then post some code that demonstrates what you are trying to do so we might have an idea :whistle: .

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I must begin with the script but I would want to create a game

You may also want to look at GUICtrlSetPos()

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 4 weeks later...

Here is how you could do it:

#include <array.au3>
Dim $aPictureFilenames[3] = [@ScriptDir & "\pic1.jpg",@ScriptDir & "\pic2.jpg",@ScriptDir & "\pic3.jpg"]

_ArrayDisplay($aPictureFilenames,"")

Random(0,2,1);will either choose 0 or 1 or 2.  The flag is set to 1 so it doesn't return decimal numbers, only integers


;here is the first way you could do it
MsgBox(0,"The image randomly chosen is:",$aPictureFilenames[Random(0,2,1)]);Now that i have shown you the command, you would use it like this

;you could also do it this way
Dim $iRandomInt = Random(0,2,1)
MsgBox(0,"The image randomly chosen is:",$aPictureFilenames[$iRandomInt]);this does the same thing as above

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...