I've left the long lines to comment on your code better.

In the future though please modify you code to prevent
the long lines.


;Good to have these options set 
If NOT @LOGONMODE
Break On
EndIf

Dim $SO

$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
;
dim $counter,$key,$val
dim $wr,$add,$wri
dim $split[],$c,$x
dim $sp[],$spl,$
;define values
$counter=0
; This is not the correct key for the Round/Lesson 2
; I changed it from Round 1 to reflect the nature of these posts better
$key='HKEY_CURRENT_USER\Software\Golfing'
$val='Round02'
;Hard coding the value prevents you from altering similar code, you're stuck with
;only being able to update this specific entry vs a more dynamic approach to alter any
;similar binary values as show in some of the other examples.
$add='28,00,00,00,ff,ff,ff,ff,02,00,00,00,03,00,00,00,3c,00,00,00,50,\ 00,00,00,fe,ff,ff,ff,b2,03,00,00,02,05,00,00,02,04,00,00'
$wri='28000000ffffffff02000000030000003c00000050000000feffffffb20300000205000002040000'


$wr=readvalue($key,$val)
$split=split($add,',')

;Code layout / indenting could be improved to greatly enhance the readablilty of the code
;for other coders that might have to modify/update your code in the future.
for each $c in $split
;The use and indentation of SELECT could be improved for readability
select
case $counter = 2 $c = 'bc' Redim preserve $sp[$counter] $sp[$counter]=$c
;Don't need IF in this Select statement could just do Case InStr then supply another CASE 1 for
;instances where the expected results are not found. ie... what if anything you want to happen
;if your code just does not return what you expect.
case 1 if instr($c,'\') $x=substr($c, len($c) - 1, 3) $=trim($x) Redim preserve $sp[$counter] $sp[$counter]=$x else Redim preserve $sp[$counter] $sp[$counter]=$c endif
endselect
$counter=$counter+1
next

;Code naming should remain constant - ie... You use "redim" above and here you have "ReDim" not
;a critical issue but more attention to such details shows a more professional style of coding
ReDim $counter
$counter=0

for $counter = 0 to ubound($sp)
$spl = $spl + $sp[$counter]
next

/*
$wr ' Read value from reg' ?
$wri ' should be equal to line above' ?
$spl ' this is what we wanna write' ?
*/
if $wr = $spl 'entry already altered' ? exit @error else $wr=writevalue($key,$val,$spl,'reg_binary') if @error 'error: ' + @ERROR @SERROR + ' ' ? else 'altered key' ? endif endif

;Code was operational as posted, but lacked any real error checking and was limited
;in scope due to hard coding of the binary data instead of dynamically reading it.
;Code structure was not really commented on as to what the code is doing which should be
;a consideration for production coding in a business.

;Very unique method and glad to see you got it going Bjorn.
;Hope to see your code submission for Lesson 3

;Thanks again for participating, if you have any questions please let us know.