Jump to content

The Robco Effect


Stimpak
 Share

Recommended Posts

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

... funny,
I also added a scoreboard effect function....

#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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

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  :thumbsup:  :bye:

Edited by ImOracle
Link to comment
Share on other sites

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  :thumbsup:  :bye:

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

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.  :thumbsup:  :bye:

Link to comment
Share on other sites

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

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