Jump to content

Reset Graphic Color.


Recommended Posts

Hi!

Mayby just a stupid thing, but I cant see it.

Whats wrong with this?

Func _RandomColor()
    $Random = Random(1, 6)
    Switch $Random
    Case 1
        $_NewColor = $_Red
    Case 2
        $_NewColor = $_Yellow
    Case 3
        $_NewColor = $_Green
    Case 4
        $_NewColor = $_Blue
    Case 5
        $_NewColor = $_Purple
    Case 6
        $_NewColor = $_Orange
    EndSwitch
    Return $_NewColor
EndFunc

ERROR

:\Documents and Settings\xxxx\Bureaublad\Test File.au3 (151) : ==> Variable used without being declared.:
Return $_NewColor
Return ^ ERROR

AlmarM

New problem. See post #3!

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

Maybe the _RandomColor() is being called somewhere in your script before the variable has been declared.

Try this

Func _RandomColor()
    Local $_NewColor
    Local $Random = Random(1, 6)
    Switch $Random
    Case 1
        $_NewColor = $_Red
    Case 2
        $_NewColor = $_Yellow
    Case 3
        $_NewColor = $_Green
    Case 4
        $_NewColor = $_Blue
    Case 5
        $_NewColor = $_Purple
    Case 6
        $_NewColor = $_Orange
    EndSwitch
    Return $_NewColor
EndFunc
Edited by Marlo
Click here for the best AutoIt help possible.Currently Working on: Autoit RAT
Link to comment
Share on other sites

Nope, and I already got it. It was the random.

Random(1, 6, 1)

AlmarM

EDIT:

My next problem, how do I reset the color of a graphic?

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

What problem?

Why not ?

ConsoleWrite(_RandomColor() & @CRLF)

Func _RandomColor()
    Local $colors[3] = ['00FF00', '0000FF', 'FF0000'] ; just example
    Return '0x' & $colors[Random(0, UBound($colors)-1 , 1)]
EndFunc

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

What problem?

Why not ?

ConsoleWrite(_RandomColor() & @CRLF)

Func _RandomColor()
    Local $colors[3] = ['00FF00', '0000FF', 'FF0000'] ; just example
    Return '0x' & $colors[Random(0, UBound($colors)-1 , 1)]
EndFunc

Mega

Yeah thx :P

And about the problem, could I add you on MSN?

Talks alot easier :unsure: PM me for email k :D?

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

Yeah thx :P

And about the problem, could I add you on MSN?

Talks alot easier :unsure: PM me for email k :D ?

AlmarM

Try your luck via ICQ.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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