#90552 - 2003-01-24 04:52 PM
Re: PostPrep-Test Post , please ignore code
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
fight for better colors:
$name="KiXWeeper v1.3" $author="1.0 unknown","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero" $Form = CreateObject("Kixtart.Form") $Form.Caption = $name $Form.BackColor = 255,255,255 $Form.ForeColor = 50,0,170 $Form.FontName = "Courier New" $Form.FontBold = 1 $Form.FontSize = 10
$level=$form.slider(,15,12,75,25) $level.tooltip="Level: 0" $level.min=11 $level.onscroll="$$level.tooltip='Level: '+($$level.value-11)" $=11 for $height=390 to $form.screen.height step 25 $=$+1 next $level.max=$-1 ;<-if you remove this -1 you will get error every time! $thislevel=11
Global $Button[$,$], $mine $map=$Button $r=0 $b=0 For $Top = 50 To ($*25+25) Step 25 For $Left = 10 To ($*25-15) Step 25 $map[$r,$b] = $Form.label(,$left,$top,25,25) $map[$r,$b].hide $map[$r,$b].alignment=2 $map[$r,$b].FontSize=14 $map[$r,$b].BorderStyle=1 $Button[$r,$b] = $Form.button(,$left,$top,25,25) $Button[$r,$b].hide $Button[$r,$b].FontBold = 1 $Button[$r,$b].onclick="button_click($r,$b)" $b=$b+1 Next $b=0 $r=$r+1 Next
$Time = $Form.Label $Time.Size = 75,30 $Time.Alignment = 1 $Time.BorderStyle = 4 $Time.Fontname = "Courier New" $Time.Fontsize = 14 $Time.Fontbold = 1 $Time.BackColor = 0 $Time.ForeColor = 255,255,0
$start=$form.button("New Game",225,10,75,25) $start.onclick="new($$level.value)"
new(11) $Form.Show
While $Form.Visible $=Execute($Form.DoEvents) Loop
Exit 1
Function Button_Click($r,$b) $=$thislevel select case not $Button[$r,$b].visible case " "=$map[$r,$b].caption $Button[$r,$b].Hide $Score=$Score+1 $Button[$r,$b].hide if $b>0 and $r>0 button_click($r-1,$b-1) endif if $r>0 button_click($r-1,$b) endif if $b<$ and $r>0 button_click($r-1,$b+1) endif if $b>0 button_click($r,$b-1) endif if $b<$ button_click($r,$b+1) endif if $b>0 and $r<$ button_click($r+1,$b-1) endif if $r<$ button_click($r+1,$b) endif if $b<$ and $r<$ button_click($r+1,$b+1) endif case instr($map[$r,$b].caption,"X") $map[$r,$b].forecolor=255,0,0 $Button[$r,$b].Hide $map[$r,$b].show for $r=0 to $ for $b=0 to $ if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif next next $timer=0 case 1 $map[$r,$b].forecolor=50,0,170 $Button[$r,$b].Hide $Score=$Score+1 endselect $map[$r,$b].show if $Score = ($+1)*($+1)-($+1)*($+1)/10 $timer=0 $=messagebox("GOOD! You made your way trough the mine fields!",$name) endif if $timer and $timer<>0 $timer=$Form.timer(1000) $timer.ontimer="$$time.caption=1+val($$time.caption)" endif EndFunction
function new($size) $score=0 $thislevel=$size $timer=1 $Time.Caption = 0 $mine=" ," srnd(@ticks) do $=rnd(($size+1)*($size+1)) if not instr($mine,$) $mine="$mine ,"+$ endif until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,"))
for $r=0 to $level.max for $b=0 to $level.max if $b>$size or $r>$size $Button[$r,$b].hide else $Button[$r,$b].caption="" $Button[$r,$b].enabled=1 $Button[$r,$b].show endif $map[$r,$b].hide $map[$r,$b].caption="" next next
$Form.Width = $size*25+50 $Form.Height = $size*25+115 $Form.Center $Time.Center $Time.Top = 10 $start.left=$form.width-95
$c=1 for $r=0 to $size for $b=0 to $size if instr($mine,",$c ,") $map[$r,$b].caption="X" endif $c=$c+1 next next
for $r=0 to $size for $b=0 to $size if not instr($map[$r,$b].caption,"X") $=0 if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif endif next next endfunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#90561 - 2003-01-24 08:57 PM
Re: PostPrep-Test Post , please ignore code
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
Top
|
|
|
|
#90563 - 2003-01-24 10:24 PM
Re: PostPrep-Test Post , please ignore code
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
for $=1 to $_ $c=substr($i,$,1) $!="" select case $c='"' $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c='"' or $=$_ until $c='"' $s=$s+$te case $c="'" $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c="'" or $=$_ until $c="'" $s=$s+$te
for $=1 to $_ $c=substr($i,$,1) $!="" select case $c='"' $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c='"' or $=$_ until $c='"' $s=$s+$te case $c="'" $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c="'" or $=$_ until $c="'" $s=$s+$te
SPACING FIXED ! HOORAY!
Another one :
$txtTarget = $frm.TextBox $txtTarget.Left = 5 $txtTarget.Top = 5 + $txtSource.Bottom $txtTarget.Right = $frm.ClientWidth - 110 $txtTarget.Bottom = $frm.ClientHeight - 20 $txtTarget.ScrollBars = 3 $txtTarget.FontName = "Courier New" $txtTarget.FontSize = 8 $txtTarget.MultiLine = 1
[ 24. January 2003, 23:42: Message edited by: jpols ]
_________________________
|
Top
|
|
|
|
#90564 - 2003-01-25 01:13 AM
Re: PostPrep-Test Post , please ignore code
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
$name="KiXWeeper v1.3" $author="1.0 unknown","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero" $Form = CreateObject("Kixtart.Form") $Form.Caption = $name $Form.BackColor = 255,255,255 $Form.ForeColor = 50,0,170 $Form.FontName = "Courier New" $Form.FontBold = 1 $Form.FontSize = 10
$level=$form.slider(,15,12,75,25) $level.tooltip="Level: 0" $level.min=11 $level.onscroll="$$level.tooltip='Level: '+($$level.value-11)" $=11 for $height=390 to $form.screen.height step 25 $=$+1 next $level.max=$-1 ;<-if you remove this -1 you will get error every time! $thislevel=11
Global $Button[$,$], $mine $map=$Button $r=0 $b=0 For $Top = 50 To ($*25+25) Step 25 For $Left = 10 To ($*25-15) Step 25 $map[$r,$b] = $Form.label(,$left,$top,25,25) $map[$r,$b].hide $map[$r,$b].alignment=2 $map[$r,$b].FontSize=14 $map[$r,$b].BorderStyle=1 $Button[$r,$b] = $Form.button(,$left,$top,25,25) $Button[$r,$b].hide $Button[$r,$b].FontBold = 1 $Button[$r,$b].onclick="button_click($r,$b)" $b=$b+1 Next $b=0 $r=$r+1 Next
$Time = $Form.Label $Time.Size = 75,30 $Time.Alignment = 1 $Time.BorderStyle = 4 $Time.Fontname = "Courier New" $Time.Fontsize = 14 $Time.Fontbold = 1 $Time.BackColor = 0 $Time.ForeColor = 255,255,0
$start=$form.button("New Game",225,10,75,25) $start.onclick="new($$level.value)"
new(11) $Form.Show
While $Form.Visible $=Execute($Form.DoEvents) Loop
Exit 1
Function Button_Click($r,$b) $=$thislevel select case not $Button[$r,$b].visible case " "=$map[$r,$b].caption $Button[$r,$b].Hide $Score=$Score+1 $Button[$r,$b].hide if $b>0 and $r>0 button_click($r-1,$b-1) endif if $r>0 button_click($r-1,$b) endif if $b<$ and $r>0 button_click($r-1,$b+1) endif if $b>0 button_click($r,$b-1) endif if $b<$ button_click($r,$b+1) endif if $b>0 and $r<$ button_click($r+1,$b-1) endif if $r<$ button_click($r+1,$b) endif if $b<$ and $r<$ button_click($r+1,$b+1) endif case instr($map[$r,$b].caption,"X") $map[$r,$b].forecolor=255,0,0 $Button[$r,$b].Hide $map[$r,$b].show for $r=0 to $ for $b=0 to $ if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif next next $timer=0 case 1 $map[$r,$b].forecolor=50,0,170 $Button[$r,$b].Hide $Score=$Score+1 endselect $map[$r,$b].show if $Score = ($+1)*($+1)-($+1)*($+1)/10 $timer=0 $=messagebox("GOOD! You made your way trough the mine fields!",$name) endif if $timer and $timer<>0 $timer=$Form.timer(1000) $timer.ontimer="$$time.caption=1+val($$time.caption)" endif EndFunction
function new($size) $score=0 $thislevel=$size $timer=1 $Time.Caption = 0 $mine=" ," srnd(@ticks) do $=rnd(($size+1)*($size+1)) if not instr($mine,$) $mine="$mine ,"+$ endif until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,"))
for $r=0 to $level.max for $b=0 to $level.max if $b>$size or $r>$size $Button[$r,$b].hide else $Button[$r,$b].caption="" $Button[$r,$b].enabled=1 $Button[$r,$b].show endif $map[$r,$b].hide $map[$r,$b].caption="" next next
$Form.Width = $size*25+50 $Form.Height = $size*25+115 $Form.Center $Time.Center $Time.Top = 10 $start.left=$form.width-95
$c=1 for $r=0 to $size for $b=0 to $size if instr($mine,",$c ,") $map[$r,$b].caption="X" endif $c=$c+1 next next
for $r=0 to $size for $b=0 to $size if not instr($map[$r,$b].caption,"X") $=0 if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif endif next next endfunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#90568 - 2003-01-25 01:51 AM
Re: PostPrep-Test Post , please ignore code
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
$name="KiXWeeper v1.3" $author="1.0 unknown","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero" $Form = CreateObject("Kixtart.Form") $Form.Caption = $name $Form.BackColor = 255,255,255 $Form.ForeColor = 50,0,170 $Form.FontName = "Courier New" $Form.FontBold = 1 $Form.FontSize = 10
$level=$form.slider(,15,12,75,25) $level.tooltip="Level: 0" $level.min=11 $level.onscroll="$$level.tooltip='Level: '+($$level.value-11)" $=11 for $height=390 to $form.screen.height step 25 $=$+1 next $level.max=$-1 ;<-if you remove this -1 you will get error every time! $thislevel=11
Global $Button[$,$], $mine $map=$Button $r=0 $b=0 For $Top = 50 To ($*25+25) Step 25 For $Left = 10 To ($*25-15) Step 25 $map[$r,$b] = $Form.label(,$left,$top,25,25) $map[$r,$b].hide $map[$r,$b].alignment=2 $map[$r,$b].FontSize=14 $map[$r,$b].BorderStyle=1 $Button[$r,$b] = $Form.button(,$left,$top,25,25) $Button[$r,$b].hide $Button[$r,$b].FontBold = 1 $Button[$r,$b].onclick="button_click($r,$b)" $b=$b+1 Next $b=0 $r=$r+1 Next
$Time = $Form.Label $Time.Size = 75,30 $Time.Alignment = 1 $Time.BorderStyle = 4 $Time.Fontname = "Courier New" $Time.Fontsize = 14 $Time.Fontbold = 1 $Time.BackColor = 0 $Time.ForeColor = 255,255,0
$start=$form.button("New Game",225,10,75,25) $start.onclick="new($$level.value)"
new(11) $Form.Show
While $Form.Visible $=Execute($Form.DoEvents) Loop
Exit 1
Function Button_Click($r,$b) $=$thislevel select case not $Button[$r,$b].visible case " "=$map[$r,$b].caption $Button[$r,$b].Hide $Score=$Score+1 $Button[$r,$b].hide if $b>0 and $r>0 button_click($r-1,$b-1) endif if $r>0 button_click($r-1,$b) endif if $b<$ and $r>0 button_click($r-1,$b+1) endif if $b>0 button_click($r,$b-1) endif if $b<$ button_click($r,$b+1) endif if $b>0 and $r<$ button_click($r+1,$b-1) endif if $r<$ button_click($r+1,$b) endif if $b<$ and $r<$ button_click($r+1,$b+1) endif case instr($map[$r,$b].caption,"X") $map[$r,$b].forecolor=255,0,0 $Button[$r,$b].Hide $map[$r,$b].show for $r=0 to $ for $b=0 to $ if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif next next $timer=0 case 1 $map[$r,$b].forecolor=50,0,170 $Button[$r,$b].Hide $Score=$Score+1 endselect $map[$r,$b].show if $Score = ($+1)*($+1)-($+1)*($+1)/10 $timer=0 $=messagebox("GOOD! You made your way trough the mine fields!",$name) endif if $timer and $timer<>0 $timer=$Form.timer(1000) $timer.ontimer="$$time.caption=1+val($$time.caption)" endif EndFunction
function new($size) $score=0 $thislevel=$size $timer=1 $Time.Caption = 0 $mine=" ," srnd(@ticks) do $=rnd(($size+1)*($size+1)) if not instr($mine,$) $mine="$mine ,"+$ endif until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,"))
for $r=0 to $level.max for $b=0 to $level.max if $b>$size or $r>$size $Button[$r,$b].hide else $Button[$r,$b].caption="" $Button[$r,$b].enabled=1 $Button[$r,$b].show endif $map[$r,$b].hide $map[$r,$b].caption="" next next
$Form.Width = $size*25+50 $Form.Height = $size*25+115 $Form.Center $Time.Center $Time.Top = 10 $start.left=$form.width-95
$c=1 for $r=0 to $size for $b=0 to $size if instr($mine,",$c ,") $map[$r,$b].caption="X" endif $c=$c+1 next next
for $r=0 to $size for $b=0 to $size if not instr($map[$r,$b].caption,"X") $=0 if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif endif next next endfunction
[ 25. January 2003, 01:56: Message edited by: Lonkero ]
_________________________
!download KiXnet
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 590 anonymous users online.
|
|
|