Jump to content
Sign in to follow this  
BAM5

zelda like annoyingness

Recommended Posts

BAM5

I was bored OK... o and if anyone has the sound file please e-mail it to me tacoman9001@yahoo.com

While 1
    $ran = Random (10, 500, 1)
    $pos = MouseGetPos ()
    ToolTip ("HEY LISTEN", $pos[0], $pos[1], "HEY LISTEN", 1, 5)
    Sleep ($ran)
WEnd

[center]JSON Encoding UDF[/center]

Share this post


Link to post
Share on other sites
Nahuel
:P

Share this post


Link to post
Share on other sites
therks

Haha, interesting. Gave me an idea... I need that PNG GUI script though.. have to find it...

Share this post


Link to post
Share on other sites
BAM5

Haha, interesting. Gave me an idea... I need that PNG GUI script though.. have to find it...

lol I know what your thinking :P


[center]JSON Encoding UDF[/center]

Share this post


Link to post
Share on other sites
therks

Got it.

#Include <GDIPlus.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $AC_SRC_ALPHA      = 1
Global Const $ULW_ALPHA         = 2

_GDIPlus_Startup()
$sImg = @ScriptDir & '\Navi.png'
$hImage = _GDIPlus_ImageLoadFromFile($sImg)
$iWidth =  _GDIPlus_ImageGetWidth ($hImage)
$iHeight = _GDIPlus_ImageGetHeight($hImage)

$iCount = 0
$gui = GUICreate('Navi', $iWidth, $iHeight, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
_SetBitMap($GUI, $hImage, 255)
GUISetState()

Dim $aText[2] = [ 'Hey!', 'Listen!' ]

Global $iTimer = TimerInit()
Global $iTextRand = Random(0, 1, 1)
Global $iTextTime = Random(3, 5, 1) * 1000
While 1
    If GUIGetMsg() = -3 Then Exit
    $aMouse = MouseGetPos()
    $iCount += 1
    
    $iX = $aMouse[0] + $iWidth + Cos($iCount / 30) * 40
    $iY = $aMouse[1] - ($iHeight * 2) + Sin($iCount / 15) * 20

    If TimerDiff($iTimer) > $iTextTime Then
        ToolTip($aText[$iTextRand], $iX + $iWidth, $iY + $iHeight, '', 0, 0)
        If TimerDiff($iTimer) > $iTextTime + 1000 Then
            $iTextRand = Random(0, 1, 1)
            $iTextTime = Random(3, 5, 1) * 1000
            $iTimer = TimerInit()
            ToolTip('')         
        EndIf
    EndIf

    WinMove($gui, '', $iX, $iY)
    Sleep(10)
WEnd

Func _SetBitMap($hGUI, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend

    $hScrDC  = _WinAPI_GetDC(0)
    $hMemDC  = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld    = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize   = DllStructCreate($tagSIZE)
    $pSize   = DllStructGetPtr($tSize  )
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth ($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend  = DllStructCreate($tagBLENDFUNCTION)
    $pBlend  = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha" , $iOpacity    )
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC   (0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC    ($hMemDC)
EndFunc

You'll need this image:

http://www.therks.com/autoit/Navi.png

Share this post


Link to post
Share on other sites
Sn0opy

it's totally useless. navi is just a small elfe which helpes zelda to find thinks or give him tips.

@Saunders: Could you upload the GDIPlus.au3 pls?

Edited by Sn0opy

Share this post


Link to post
Share on other sites
weaponx

I'm thinking hes running the new beta with the gdi functions integrated.

Share this post


Link to post
Share on other sites
Sn0opy

I modified Saunders version :P

#Include <GDIPlus.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $AC_SRC_ALPHA      = 1
Global Const $ULW_ALPHA         = 2

_GDIPlus_Startup()
$sImg = @ScriptDir & '\Navi.png'
$hImage = _GDIPlus_ImageLoadFromFile($sImg)
$iWidth =  _GDIPlus_ImageGetWidth ($hImage)
$iHeight = _GDIPlus_ImageGetHeight($hImage)

$iCount = 0
$gui = GUICreate('Navi', $iWidth, $iHeight, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
_SetBitMap($GUI, $hImage, 255)
GUISetState()

Dim $aText[2] = [ '\hey.mp3', '\listen.mp3' ]

Global $iTimer = TimerInit()
Global $iTextRand = Random(0, 1, 1)
Global $iTextTime = Random(3, 5, 1) * 1000
While 1
    If GUIGetMsg() = -3 Then Exit
    $aMouse = MouseGetPos()
    $iCount += 1
    
    $iX = $aMouse[0] + $iWidth + Cos($iCount / 30) * 40
    $iY = $aMouse[1] - ($iHeight * 2) + Sin($iCount / 15) * 20

    If TimerDiff($iTimer) > $iTextTime Then
        SoundPlay(@ScriptDir & $aText[$iTextRand])
        ;ToolTip($aText[$iTextRand], $iX + $iWidth, $iY + $iHeight, '', 0, 0)
        If TimerDiff($iTimer) > $iTextTime + 1000 Then
            $iTextRand = Random(0, 1, 1)
            $iTextTime = Random(3, 5, 1) * 1000
            $iTimer = TimerInit()
            ;ToolTip('')   
        EndIf
    EndIf

    WinMove($gui, '', $iX, $iY)
    Sleep(10)
WEnd

Func _SetBitMap($hGUI, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend

    $hScrDC  = _WinAPI_GetDC(0)
    $hMemDC  = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld    = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize   = DllStructCreate($tagSIZE)
    $pSize   = DllStructGetPtr($tSize  )
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth ($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend  = DllStructCreate($tagBLENDFUNCTION)
    $pBlend  = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha" , $iOpacity    )
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC   (0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC    ($hMemDC)
EndFunc

Download these files:

http://sascha.kiloswiss.ch/uploads/files/sounds/hey.mp3

http://sascha.kiloswiss.ch/uploads/files/sounds/listen.mp3

Share this post


Link to post
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
Sign in to follow this  

×