Jump to content

the DtTvB

Active Members
  • Posts

    112
  • Joined

  • Last visited

About the DtTvB

  • Birthday 05/23/1993

Profile Information

  • Location
    Thailand

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

the DtTvB's Achievements

Adventurer

Adventurer (3/7)

1

Reputation

  1. Hope you like it. The commentating is the hardest part for me. It may be buggy if you move your mouse too fast. You can move your mouse clockwise and counter clockwise. ; Some greeting tooltips! toolTip ('Get ready to move your mouse round the screen.', 20, 20, 'Mouse-Go-Round!', 1); sleep (2000); toolTip ('Three!', 20, 20, 'Mouse-Go-Round!', 1); sleep (1000); toolTip ('Two!', 20, 20, 'Mouse-Go-Round!', 1); sleep (1000); toolTip ('One and...', 20, 20, 'Mouse-Go-Round!', 1); sleep (1000); toolTip ('GO!', 20, 20, 'Mouse-Go-Round!', 1); ; The pie, mutiplied by 2. global $twopi = 3.141592653589793 * 2; ; Get the hypotenuse from another 2 sides of the right-angled triangle. func getHypotenuse($x, $y) return sqrt(($x ^ 2) + ($y ^ 2)); endFunc; ; Get the angle from $x and $y. func getAngle($x, $y) $dist = getHypotenuse($x, $y); if ($dist <= 0) then; return 0; endIf; $angle = round((aSin($x / $dist) / $twopi) * 360); if ($y > 0) then; $angle = 180 - $angle; endIf; if ($angle < 0) then; $angle += 360; endIf; return $angle; endFunc; ; Get the angle from the mouse, relative to the centre of the screen. func getAngleFromMouse() $pos = mouseGetPos(); $pos[0] -= @DesktopWidth / 2; $pos[1] -= @DesktopHeight / 2; return getAngle($pos[0], $pos[1]); endFunc; ; Initialize the function. $oldAngle = getAngleFromMouse(); $sumAngle = 0; $calAngle = 0; ; Loop for 10 seconds (400 * 25). for $i = 0 to 400; ; Get the new angle and compare with the old one. $newAngle = getAngleFromMouse(); $difAngle = ($newAngle - $oldAngle); ; A lot of difference! It should be no more than 180 degrees. if ($difAngle > 180) then; $difAngle = 360 - $difAngle; endIf; if ($difAngle < -180) then; $difAngle = -360 - $difAngle; endIf; ; Add it to the sum, and calculate the number of rounds. $sumAngle += $difAngle; $calAngle = round(abs($sumAngle / 180), 3); ; Display the tooltip after 1 second. if ($i > 40) then $s = 's'; if ($calAngle == 1) then; $s = ''; endIf; $sc = round((400 - $i) / 40, 2); $s2 = 's'; if ($sc == 1) then; $s2 = ''; endIf; toolTip ('You moved your mouse ' & $calAngle & ' time' & $s & ' round the screen!' & @CrLf & 'You have ' & $sc & ' second' & $s2 & ' left!', 20, 20, 'Mouse-Go-Round!', 1); endIf; ; Change the old angle. $oldAngle = getAngleFromMouse(); ; Sleep. sleep (25); next; ; Game over. toolTip ('Game over! You moved your mouse ' & $calAngle & ' time' & $s & '!', 20, 20, 'Mouse-Go-Round!', 1); sleep (2000);
  2. Cool Script! Thank you.
  3. This is not confirmed to be 100% working, but it works in most cases. If you like/hate this script, if you have some way to make this better, or if you found a bug, please comment! This function turn arrays like this: [0] = hello [1] = this [2] = is [3][0] = a [3][1] = test ... Into a string like this: [39=4-$5=hello$4=this$2=is[13=2-$1=a$4=test And it can convert the string back to array. ; This function gets the value of $x and return it into this format: ; [length]:[data] func _serializeDataFormat($x); $y = string(($x)); return stringLen($y) & '=' & ($y); endFunc; ; This function turns a variable into an string. func _serialize($x); ; Array? List list through each element. if (isArray($x)) then; local $r; local $b = ubound($x); local $i; $r = $b & '-' for $i = 0 to $b - 1; ; Recursively call the serialize function to collect more data. $r &= _serialize($x[$i]); next; ; Return it. return '[' & stringLen($r) & '=' & $r; ; Other types? elseIf (isBinaryString($x)) then; return '#' & _serializeDataFormat($x); elseIf (isBool($x)) then; if ($x) then; return '?1=t'; else return '?1=f'; endIf; elseIf (isHWnd($x)) then; return '*' & _serializeDataFormat($x); elseIf (isNumber($x)) then; return '&' & _serializeDataFormat($x); elseIf (isString($x)) then; return '$' & _serializeDataFormat($x); endIf; endFunc; ; This function parses boolean data. func _unserializeBool($v); if ($v == 't') then return true; else; return false; endIf; endFunc; ; This function changes string back to data. func _unserialize($x, $ia = 0); ; If this function was called recursively, $ia is set to 1. ; Don't set $ia outside this function! if ($ia) then ; Create a temp array. local $bnd = stringLeft($x, stringInStr($x, '-') - 1); local $rar[number($bnd)]; $x = stringMid($x, stringLen($bnd) + 2); endIf; local $typ; local $len; local $dst; local $i = 0; do; ; Loop, loop, loop. until $x is empty. ; Get the data type. $typ = stringMid($x, 1, 1); $x = stringMid($x, 2); ; Get the length of the data. $len = stringLeft($x, stringInStr($x, '=') - 1); ; Get the data. $dst = stringMid($x, stringLen($len) + 2, $len); $x = stringMid($x, stringLen($len) + 2 + $len); ; Not array? if ($typ = '#') then; if ($ia) then; $rar[$i] = binaryString($dst); $i += 1; else; return binaryString($dst); endIf; elseIf ($typ = '?') then; if ($ia) then; $rar[$i] = _unserializeBool($dst); $i += 1; else; return _unserializeBool($dst); endIf; elseIf ($typ = '*') then; if ($ia) then; $rar[$i] = hWnd($dst); $i += 1; else; return hWnd($dst); endIf; elseIf ($typ = '&') then; if ($ia) then; $rar[$i] = number($dst); $i += 1; else; return number($dst); endIf; elseIf ($typ = '$') then; if ($ia) then; $rar[$i] = string($dst); $i += 1; else; return string($dst); endIf; ; Array? elseIf ($typ = '[') then; if ($ia) then; $rar[$i] = _unserialize($dst, 1); $i += 1; else; return _unserialize($dst, 1); endIf; ; Unrecognized? else if ($ia) then; $rar[$i] = 'Error'; return $rar; $i += 1; else; return 'Error'; endIf; exitLoop; endIf; until not($ia and stringLen($x) > 0) ; Well, return it! if ($ia) then; return $rar; endIf; endFunc;
  4. Yeah, this script's aim is to produce a ZIP file in pure AutoIt with good speed, I don't think the compression may be used.
  5. Here is the website that have the compression code, but not in AutoIt: http://www.zlib.net/ I think doing that without calling a DLL in AutoIt would be very hard, and maybe slow.
  6. Very cool! I've done it in PHP before, but it's not working anymore! To get the title of the page, I suggested this Regexp: <(?i)a class=l href="(.*?)">(.*?)</a>
  7. Well, after 4 hours of working, I, and spyrorocks finally did it! Here is the source code: source.zip Actually, the source code zip file was made using this script also. Limitations: You must create a folder first or the archive may corrupt.No compression, man!Credits:The ZIP creation script was originally made in PHP by Eric Mueller <http://www.themepark.com>.And the CRC32 script was converted from Visual Basic at http://www.di-mgt.com.au/src/basCRC32.txtConverted to AutoIt script by the DtTvB and Spyrorocks.If you see any bugs please report. the DtTvB
  8. I used No-IP and Yi.org. They are both cool! Actually, in my DNS record, dttvb.yi.org CNAMEs to 62sv2.hopto.org. Uhh. By the way, I installed the latest version of AutoIt, and it still doesn't work. I am still wondering why does the release work really fine!
  9. Thank you piccaso, it still doesn't work...
  10. Oh, my computer, maybe, is slow. Seconds used: 27.486799299911.
  11. Yeah, I know. Ummm, there are not any problem with HTML, but it makes an error with CGI scripts. Testcase: ConsoleWrite(@CrLf); Expected: 10 13 Output: 10 10 13
  12. Darn, darn, darn, I can't use the server on my PC, as the program keeps changing Cr to CrCr. Anyway I can still telnet to it.
  13. Spyrorocks: I've made the basic auth already. See these two files in the repository: - public_html/base64.au3 - public_html/www-auth.aux
  14. Yes, I am sorry. I tried rev. 20 with PHP and it worked. And about CGI, I forgot about it that it waits for the output. You know that if a client doesn't set output, the environment variable won't be set, and therefore, won't be deleted. So I used ZZID to provide unique ID for each request. _m displays an informational balloon message, and _e displays an error message. About reload configuration, I don't even notice that it does exists! I am also going to test perl also.
  15. Uhh, sorry that I haven't help with the code, I am too busy these days. I will try to help as much as I can. Wow, PHP, never know of this! Really cool. About the name, The AutoIt Community Web Server would be great. For the small name, what about Auws? About configging the program, what about placing a script into a site, say, config.aux? I think it would be fairly easy to do. For preventing other people to access it, I can getEnv('REMOTE_ADDR')
×
×
  • Create New...