Jump to content

Small code


Recommended Posts

I need a code that can make this thing :

$a = 0
$b = 0

While True
 $f = GenerateNumber() ; returns a random integer

 $a = $f
 
 ; Now the problem is that i want something like $a has the current generated number and
 ; $b the previous
 ; Ex : step 1 : $a = 10 $b = 0 ; no previous number generated
 ;      step 2 : $a = 20 $b = 10 
 ;      step 2 : $a = 110 $b = 20 
 ; and so on ... 
 ;
 ; It's driving me nuts !!! Please bring some "light" here.

Wend
Edited by OmYcroN
Link to comment
Share on other sites

My version:

$a = 0
$b = 0
$i = 0
While $i < 10
    $a = Random(10, 99, 1)
    ConsoleWrite("$a = " & $a & ", $b = " & $b & @CRLF)
    $b = $a
    $i += 1
Wend

Br,

UEZ:idea:

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I had to do the same a while ago.

Here you go:

HotKeySet("{ESC}", "_Exit")

Global $a = 0, $b = 0

While Sleep(25)
    $f = Random(1, 100, 1)
    $b = $a
    $a = $f

    MsgBox(0, "", "Current generated number:    " & $a & @CRLF & "Previous generated number:    " & $b)
WEnd

Func _Exit()
    Exit
EndFunc

;)

EDIT: Didn't saw UEZ's post. Both options both ^^

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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...