Stimpak Posted January 25, 2015 Share Posted January 25, 2015 Just a small function to type a character one by one, like the Robco terminals from the Fallout games. Not sure if this would be useful to anyone, but I was recreating a Robco terminal and decided to share this. Example Usage: Robco('Robco Industries Unified Operating System', $Terminal, 200) Function: Func Robco($string, $control, $time) $Temp = '' $Str = StringSplit($string, '') For $C = 1 To $Str[0] GUICtrlSetData($control, $Temp & $Str[$C]) $Temp &= $Str[$C] Sleep($time) Next EndFunc Full Example: #include <GUIConstants.au3> GUICreate("Robco Terminal", 500, 400) $Terminal = GUICtrlCreateLabel("", 200, 30, 150, 30) GUISetState() Robco('Robco Industries Unified Operating System', $Terminal, 200) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Robco($string, $control, $time) $Temp = '' $Str = StringSplit($string, '') For $C = 1 To $Str[0] GUICtrlSetData($control, $Temp & $Str[$C]) $Temp &= $Str[$C] Sleep($time) Next EndFunc Link to comment Share on other sites More sharing options...
Gianni Posted January 26, 2015 Share Posted January 26, 2015 ... funny, I also added a scoreboard effect function.... expandcollapse popup#include <GUIConstants.au3> GUICreate("Robco Terminal", 500, 400) $Terminal = GUICtrlCreateLabel("", 200, 30, 150, 30) GUISetState() ; Robco('Robco Industries Unified Operating System', $Terminal, 200) Scoreboard('Robco Industries Unified Operating System', $Terminal, 80) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Robco($string, $control, $time) $Temp = '' $Str = StringSplit($string, '') For $C = 1 To $Str[0] GUICtrlSetData($control, $Temp & $Str[$C]) $Temp &= $Str[$C] Sleep($time) Next EndFunc ;==>Robco Func Scoreboard($string, $control, $time) Local $Y = StringToASCIIArray($string), $Z[UBound($Y)], $match = 0 For $i = 0 To UBound($z) - 1 $z[$i] = 31 Next While $match < UBound($z) $match = 0 For $i = 0 To UBound($z) - 1 If $z[$i] <> $Y[$i] Then $z[$i] += 1 $match += $z[$i] = $Y[$i] Next GUICtrlSetData($control, StringFromASCIIArray($z)) Sleep($time) WEnd EndFunc ;==>Scoreboard Stimpak 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Stimpak Posted January 26, 2015 Author Share Posted January 26, 2015 I like that scoreboard effect. I'm gonna use it in some of my scripts and thank you for sharing it. Link to comment Share on other sites More sharing options...
ImOracle Posted January 27, 2015 Share Posted January 27, 2015 (edited) Found a little bug where you cant close the window while the text is being typed out. Fix: #include <GUIConstantsEx.au3> #include <GUIConstants.au3> GUICreate("Robco Terminal", 500, 400) $Terminal = GUICtrlCreateLabel("", 200, 30, 150, 30) GUISetState() Robco('Robco Industries Unified Operating System', $Terminal, 200) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Robco($string, $control, $time) AdlibRegister("IsClosedPressed", 50);use 50 else the function would be called to late and the GUI wouldn't close. Can be lowered even more but i don't know if the CPU would approve... $Temp = '' $Str = StringSplit($string, '') For $C = 1 To $Str[0] GUICtrlSetData($control, $Temp & $Str[$C]) $Temp &= $Str[$C] Sleep($time) Next AdlibUnRegister("IsClosedPressed") EndFunc Func IsClosedPressed() $iMsg=GUIGetMsg() If $iMsg = $GUI_EVENT_CLOSE Then Exit EndIf EndFunc hope i could help Edited January 27, 2015 by ImOracle Link to comment Share on other sites More sharing options...
Stimpak Posted January 27, 2015 Author Share Posted January 27, 2015 Found a little bug where you cant close the window while the text is being typed out. Fix: #include <GUIConstantsEx.au3> #include <GUIConstants.au3> GUICreate("Robco Terminal", 500, 400) $Terminal = GUICtrlCreateLabel("", 200, 30, 150, 30) GUISetState() Robco('Robco Industries Unified Operating System', $Terminal, 200) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Robco($string, $control, $time) AdlibRegister("IsClosedPressed", 50);use 50 else the function would be called to late and the GUI wouldn't close. Can be lowered even more but i don't know if the CPU would approve... $Temp = '' $Str = StringSplit($string, '') For $C = 1 To $Str[0] GUICtrlSetData($control, $Temp & $Str[$C]) $Temp &= $Str[$C] Sleep($time) Next AdlibUnRegister("IsClosedPressed") EndFunc Func IsClosedPressed() $iMsg=GUIGetMsg() If $iMsg = $GUI_EVENT_CLOSE Then Exit EndIf EndFunc hope i could help That isn't a bug. That is completely normal. Closing the window before completing my desired task seems slightly counter-productive in my view. Link to comment Share on other sites More sharing options...
ImOracle Posted January 28, 2015 Share Posted January 28, 2015 That isn't a bug. That is completely normal. Closing the window before completing my desired task seems slightly counter-productive in my view. well back in the days when you were watching porn and youre mom came into the room and you quickly tried closing the browser there wasnt a popup like "dude the video hasnt even finished, why are you closing me ;(" at least thats how i would look at it. and sorry if that example was a bit weird, harsh whatever. Link to comment Share on other sites More sharing options...
Stimpak Posted January 29, 2015 Author Share Posted January 29, 2015 We grew up completely different. @Ontpic: Well thanks sharing it otherwise. It could prove useful to me maybe, but I usually use an {ESC} hotkey to close my scripts. I use a laptop, and I find it's just easier to hit Esc rather than touching my mousepad. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now