アプリ版:「スタンプのみでお礼する」機能のリリースについて

色の分析をActive Basicでおこなっています。
IFで条件に当てはまった場合gotoで途中の計算を飛ばしたいのですが、
ジャンプ先が不正となってしまいます。
ご指摘よろしくお願いいたします。

プログラムです
↓↓↓↓

#include "t.idx"
#include "s.sbp"


#N88BASIC

' ↓ ここからプログラムが実行されます

Dim a As String, FileName As String
Dim hBmp As Long
Dim nRed as Long, nGreen as Long, nBlue as Long,
Dim R as Single, G as Single, B as Single
Dim max as Single, min as Single
Dim H as Single, S as Single, V as Single
Dim Ha as Long, Sa as Single, Va as Single
Dim Hb as Long, Sb as Single, Vb as Single
Dim Hc as Long, Sc as Single, Vc as Single
Dim Hd as Long, Sd as Single, Vd as Single
Dim He as Long, Se as Single, Ve as Single
Dim Hf as Long, Sf as Single, Vf as Single
Dim nflame As Long
Dim x As Long, y As Long, r As Long
Dim hh as string

for nflame=1 to 2 ' ←この数字を、分析する画像ファイル数に変える

FileName="c:\ab\"+Str$(nflame)+".bmp" 'c:\ab\ というフォルダに、分析する画像を、1.bmp、2.bmp・・と保存しておく
BLoad(FileName , hBmp )
PutBmp( 1,1, hBmp )
GetBmp( 1,1,382 ,215, hBmp ) 'ここにx、y解像度をいれる

a="c:\ab\"+"ironobori1.txt" '色のデータ
open a as #1

cls '1列か1枚ごとに数値を0に戻す
Ha=0:Hb=0:Hc=0:Hd=0:He=0:Hf=0:Sa=0:Sb=0:Sc=0:Sd=0:Se=0:Sf=0:Va=0:Vb=0:Vc=0:Vd=0:Ve=0:Vf=0

for x=1 to 382 'この320が、画像解像度のx成分
for y=1 to 215 'この240が、画像解像度のy成分

r = Point( x, y )
nRed = ( r And &HFF )
nGreen = ( r And &HFF00 ) / &H100
nBlue = ( r And &HFF0000 ) / &H10000

R=nRed/255
G=nGreen/255
B=nBlue/255


If R=0 and G=0 and B=0 then goto 104
If R=90 and G=100 and B=100 then goto 104

**********************************
ここでgotoできません。
**********************************


If R => G and R=> B then max=R
If G => R and G => B then max=G
If B => R and B =>G then max=B
If R <= G and R <= B then min=R
If G <= R and G <= B then min=G
If B <= R and B <= G then min=B

If max=R then H=60*(G-B)/(max-min)
If max=G then H=60*(B-R)/(max-min)+120
If max=B then H=60*(R-G)/(max-min)+240
S=(max-min)/max
V=max


If H=>0 and H<60 then
Ha=Ha+1
Va=Va+V
Sa=Sa+S
End If

If H=>60 and H<120 then
Hb=Hb+1
Vb=Vb+V
Sb=Sb+S
End If

If H=>120 and H<180 then
Hc=Hc+1
Vc=Vc+V
Sc=Sc+S
End If

If H=>180 and H<240 then
Hd=Hd+1
Vd=Vd+V
Sd=Sd+S
End If

If H=>240 and H<300 then
He=He+1
Ve=Ve+V
Se=Se+S
End If

If H=>300 and H<=360 then
Hf=Hf+1
Vf=Vf+V
Sf=Sf+S
End If

Ha=Ha+0
Hb=Hb+0
Hc=Hc+0
Hd=Hd+0
He=He+0
Hf=Hf+0
Sa=Sa+0
Sb=Sb+0
Sc=Sc+0
Sd=Sd+0
Se=Se+0
Sf=Sf+0
Va=Va+0
Vb=Vb+0
Vc=Vc+0
Vd=Vd+0
Ve=Ve+0
Vf=Vf+0

Next y
Next x

print x,y,Ha,Hb,Hc,Hd,He,Hf

write #1,Ha,Hb,Hc,Hd,He,Hf

FinishBmp( hBmp )

Next nflame

close #1

End

A 回答 (3件)

http://www.geocities.jp/debu0510/basic/main8.html
諸悪の根源 -Goto文- を参照願います。

単にジャンプ先のラベルがないからでは?
    • good
    • 0
この回答へのお礼

回答ありがとうございます。
無事に解決いたしました。
ありがとうございます。

お礼日時:2009/01/15 13:25

ActiveBasicは知りませんが、意図するgotoの飛び先は


Ha=Ha+0
あたりの行ですか?
もしやテキストの104行目と行番号としての104を
混同されているのでは?と思うのですが。
    • good
    • 0
この回答へのお礼

回答ありがとうございます。
ご指摘どおり、混同していました。
無事に解決いたしました。
ありがとうございます。

お礼日時:2009/01/15 13:27

同じような内容ですが最近の構造化言語では、このような問題を避けるためにgoto命令は使用しません。


subやfunctionを使ってわかりやすいプログラミングをしましょう。
    • good
    • 0
この回答へのお礼

回答ありがとうございます。
無事に解決いたしました。
ありがとうございます。

お礼日時:2009/01/15 13:26

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!