 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ManaUser
Joined: 24 May 2007 Posts: 906
|
Posted: Fri Mar 14, 2008 9:16 pm Post subject: |
|
|
| tic wrote: | I find it strange that you do this:
| Code: | Loop Parse, XSpeeds, :
XSpeed%A_Index% := A_LoopField
Loop Parse, YSpeeds, :
YSpeed%A_Index% := A_LoopField |
|
Good point. It hardly matters since it only runs once, but I'll fix it. |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 689
|
Posted: Sat Mar 15, 2008 6:49 pm Post subject: |
|
|
Awsome Script
You should develop iut too do more things
Maybe sleep
A bed pciture comes up and he sleeps on it
also maybe it could talk _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2436
|
Posted: Sat Mar 15, 2008 8:38 pm Post subject: |
|
|
LOL Cool. It would make a cool screensaver if there was another one appearing every minute until there are a hundred of so running around... |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1375
|
Posted: Sat Mar 15, 2008 9:08 pm Post subject: |
|
|
| Well the alphablended code i posted can easily be used to write the whole thing however complex in no time. |
|
| Back to top |
|
 |
k3ph
Joined: 20 Jul 2006 Posts: 174
|
Posted: Sun Mar 16, 2008 7:23 am Post subject: |
|
|
| hey very nice, thanks for sharing it! |
|
| Back to top |
|
 |
Nick[420Money]
Joined: 27 Oct 2007 Posts: 21 Location: Hawaii
|
Posted: Tue Mar 18, 2008 7:26 pm Post subject: |
|
|
SWEEEET lol i have alot going around i put a time into the script and made it re create a new amount of time to wait till it made a new one and i used tics alpha blended code and got this one appeard between like 10secs. - 1 min
[img=http://img243.imageshack.us/img243/3175/spidazou6.th.png] _________________
0100111001101001011000110110101101011011001101000011001000110000010011010110111101101110011001010111100101011101 |
|
| Back to top |
|
 |
ManaUser
Joined: 24 May 2007 Posts: 906
|
Posted: Wed Mar 19, 2008 4:13 am Post subject: |
|
|
Sounds cool, feel free to post your modified version.
I haven't done much more on this myself. I've written code for the bug to follow (or flee from) a point on the screen, but I haven't put it to good use yet. Here's a sample that makes it follow the mouse pointer, but I don't really like the effect, at least not for all the time. It conflicts with the behavior where it runs when you point at it, so I disbaled that in this example.
| Code: | #SingleInstance Force
#NoEnv
CoordMode Mouse, Screen
SetBatchLines -1
SetWinDelay -1
IfNotExist bug
{
FileCreateDir bug
Loop 17
UrlDownloadToFile http://www.autohotkey.net/~ManaUser/bugs/bug%A_Index%.png, bug\bug%A_Index%.png
}
SetWorkingDir bug
Gui Color, White
Loop 16
{
Gui Add, Picture, x0 y0 gGrab, bug%A_Index%.png
GuiControl Hide, bug%A_Index%.png
}
Gui Add, Picture, x0 y0 gWipe, bug17.png
GuiControl Hide, bug17.png
Gui -Caption +ToolWindow +AlwaysOnTop +LastFound
WinSet, TransColor, White
TheBug := WinExist()
Gui Show, w16 h16 y0, NA
WinGetPos X, Y
XSpeeds := "0:1:2:3:3:3:2:1:0:-1:-2:-3:-3:-3:-2:-1"
YSpeeds := "-3:-3:-2:-1:0:1:2:3:3:3:2:1:0:-1:-2:-3"
StringSplit XSpeed, XSpeeds, :
StringSplit YSpeed, YSpeeds, :
Speed := 1
Random Dir, 1, 9
SetTimer Move, 50
GoSub Move
Return
Move:
MouseGetPos, Mx, My, UnderMouse
;If (TheBug = UnderMouse)
;{
; Speed := 3
; SetTimer SlowDown, -525
; SetTimer SlowMore, -1525
;}
X += XSpeed%Dir% * Speed
Y += YSpeed%Dir% * Speed
If (X < -16)
X := -16
Else If (X > A_ScreenWidth)
X := A_ScreenWidth
If (Y < -16)
Y := -16
Else If (Y > A_ScreenHeight)
Y := A_ScreenHeight
GuiControl Hide, bug%Dir%.png
;Dir := NewDirRnd()
Dir := NewDirChase(Mx, My, 50) ;<-- (X, Y, Influence), also try NewDirFlee
GuiControl Show, bug%Dir%.png
Gui +LastFound
WinMove, X, Y
Gui Show, NA
Return
NewDirRnd()
{
Global Dir
Random Rand, 0, 1
Rand := Rand & !GetKeyState("Left") | GetKeyState("Right")
NewDir := WrapDir(Dir + (Rand ? 1 : -1))
Return NewDir
}
NewDirChase(TargetX, TargetY, Influence = 50, Flee = False)
{
Global Dir, X, Y
Random Rand, 1, 100
If (Influence < Rand)
Return NewDirRnd()
Random Rand, 0, 1
NewDir := WrapDir(Dir + (Rand ? 1 : -1))
AltDir := WrapDir(Dir + (!Rand ? 1 : -1))
NewDist := Distance(X+8+XSpeed%NewDir%, Y+8+YSpeed%NewDir%, TargetX, TargetY)
AltDist := Distance(X+8+XSpeed%AltDir%, Y+8+YSpeed%AltDir%, TargetX, TargetY)
Return (AltDist < NewDist) ^ Flee ? AltDir : NewDir
}
NewDirFlee(TargetX, TargetY, Influence = 50)
{
Return NewDirChase(TargetX, TargetY, Influence, True)
}
WrapDir(wDir)
{
If (wDir = 0)
Return 16
If (wDir = 17)
Return 1
Return wDir
}
Distance(X1, Y1, X2, Y2)
{
Return Sqrt(Abs( (X1-X2)**2 + (Y1-Y2)**2 ))
}
SlowDown:
Speed := 2
Return
SlowMore:
Speed := 1
Return
Grab:
SetTimer Move, Off
SetTimer SlowDown, Off
SetTimer SlowMore, Off
SetTimer Hold, 50
Wiggle := 1
If (Dir = 16)
Dir := 1
Return
Hold:
MouseGetPos X, Y
X -= 8, Y -= 8
Random Rand, 0, 1
If Rand
{
GuiControl Hide, bug%Dir%.png
Dir += Wiggle
GuiControl Show, bug%Dir%.png
Wiggle *= -1
}
Gui +LastFound
WinMove, X, Y
If GetKeyState("LButton") = 0
{
SetTimer Hold, Off
SetTimer Move, 50
}
Return
GuiContextMenu: ;Squish
SetTimer Move, Off
SetTimer Hold, Off
Gui Show, Hide
GuiControl Hide, bug%Dir%.png
GuiControl Show, bug17.png
Gui Show, NA
Sleep 60000
Wipe:
ExitApp
Return |
Edit: Thanks for pointing out that goof with UrlDownloadToFile. (Fixed now.)
Last edited by ManaUser on Wed Mar 19, 2008 10:44 pm; edited 3 times in total |
|
| Back to top |
|
 |
Nick[420Money]
Joined: 27 Oct 2007 Posts: 21 Location: Hawaii
|
Posted: Wed Mar 19, 2008 8:23 pm Post subject: |
|
|
oh hang on im gonna try and make like a little box where you can have an accual convo with him if you nice he will follow then if yor annoying then he will run!! that was a very good but random idea
BTW: url download to file is missing a parameter im assuming it the same as the old so this is it
EDIT: oh wait you just pressed enter i see but you had me for a sec lol
| Code: | #SingleInstance Force
#NoEnv
CoordMode Mouse, Screen
SetBatchLines -1
SetWinDelay -1
IfNotExist bug
{
FileCreateDir bug
Loop 17
UrlDownloadToFile http://www.autohotkey.net/~ManaUser/bugs/bug%A_Index%.png, bug\bug%A_Index%.png
}
SetWorkingDir bug
Gui Color, White
Loop 16
{
Gui Add, Picture, x0 y0 gGrab, bug%A_Index%.png
GuiControl Hide, bug%A_Index%.png
}
Gui Add, Picture, x0 y0 gWipe, bug17.png
GuiControl Hide, bug17.png
Gui -Caption +ToolWindow +AlwaysOnTop +LastFound
WinSet, TransColor, White
TheBug := WinExist()
Gui Show, w16 h16 y0, NA
WinGetPos X, Y
XSpeeds := "0:1:2:3:3:3:2:1:0:-1:-2:-3:-3:-3:-2:-1"
YSpeeds := "-3:-3:-2:-1:0:1:2:3:3:3:2:1:0:-1:-2:-3"
StringSplit XSpeed, XSpeeds, :
StringSplit YSpeed, YSpeeds, :
Speed := 1
Random Dir, 1, 9
SetTimer Move, 50
GoSub Move
Return
Move:
MouseGetPos, Mx, My, UnderMouse
;If (TheBug = UnderMouse)
;{
; Speed := 3
; SetTimer SlowDown, -525
; SetTimer SlowMore, -1525
;}
X += XSpeed%Dir% * Speed
Y += YSpeed%Dir% * Speed
If (X < -16)
X := -16
Else If (X > A_ScreenWidth)
X := A_ScreenWidth
If (Y < -16)
Y := -16
Else If (Y > A_ScreenHeight)
Y := A_ScreenHeight
GuiControl Hide, bug%Dir%.png
;Dir := NewDirRnd()
Dir := NewDirChase(Mx, My, 50) ;<-- (X, Y, Influence), also try NewDirFlee
GuiControl Show, bug%Dir%.png
Gui +LastFound
WinMove, X, Y
Gui Show, NA
Return
NewDirRnd()
{
Global Dir
Random Rand, 0, 1
Rand := Rand & !GetKeyState("Left") | GetKeyState("Right")
NewDir := WrapDir(Dir + (Rand ? 1 : -1))
Return NewDir
}
NewDirChase(TargetX, TargetY, Influence = 50, Flee = False)
{
Global Dir, X, Y
Random Rand, 1, 100
If (Influence < Rand)
Return NewDirRnd()
Random Rand, 0, 1
NewDir := WrapDir(Dir + (Rand ? 1 : -1))
AltDir := WrapDir(Dir + (!Rand ? 1 : -1))
NewDist := Distance(X+8+XSpeed%NewDir%, Y+8+YSpeed%NewDir%, TargetX, TargetY)
AltDist := Distance(X+8+XSpeed%AltDir%, Y+8+YSpeed%AltDir%, TargetX, TargetY)
Return (AltDist < NewDist) ^ Flee ? AltDir : NewDir
}
NewDirFlee(TargetX, TargetY, Influence = 50)
{
Return NewDirChase(TargetX, TargetY, Influence, True)
}
WrapDir(wDir)
{
If (wDir = 0)
Return 16
If (wDir = 17)
Return 1
Return wDir
}
Distance(X1, Y1, X2, Y2)
{
Return Sqrt(Abs( (X1-X2)**2 + (Y1-Y2)**2 ))
}
SlowDown:
Speed := 2
Return
SlowMore:
Speed := 1
Return
Grab:
SetTimer Move, Off
SetTimer SlowDown, Off
SetTimer SlowMore, Off
SetTimer Hold, 50
Wiggle := 1
If (Dir = 16)
Dir := 1
Return
Hold:
MouseGetPos X, Y
X -= 8, Y -= 8
Random Rand, 0, 1
If Rand
{
GuiControl Hide, bug%Dir%.png
Dir += Wiggle
GuiControl Show, bug%Dir%.png
Wiggle *= -1
}
Gui +LastFound
WinMove, X, Y
If GetKeyState("LButton") = 0
{
SetTimer Hold, Off
SetTimer Move, 50
}
Return
GuiContextMenu: ;Squish
SetTimer Move, Off
SetTimer Hold, Off
Gui Show, Hide
GuiControl Hide, bug%Dir%.png
GuiControl Show, bug17.png
Gui Show, NA
Sleep 60000
Wipe:
ExitApp
Return |
_________________
0100111001101001011000110110101101011011001101000011001000110000010011010110111101101110011001010111100101011101 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|