HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2013
0913
EFGHある場所にマウスを置いたときの処理を簡潔にしてほしいです。4解決


EFGH

リンク

2013/9/13(Fri) 10:34:30|NO.57115

#uselib "user32.dll"
#func GetCursorPos "GetCursorPos" int
#func ScreenToClient "ScreenToClient" int,int
onexit *e
screen 0,640,480,0
color 0,0,0 :boxf 50,50,100,100
color 0,0,0 :boxf 150,150,200,200
pos 0,0
button "2",*messe
dim point,2
mmload "銃声.mp3",0,0
dialog
*loops
GetCursorPos varptr(point)
ScreenToClient hWnd,varptr(point)
if ((point(0)>=50)&(point(0)<=100)&(point(1)>=50)&(point(1)<=100) ^ chkcode){
chkcode^=1
if chkcode:mes "1個目"
await 10
}
if ((point(0)>=150)&(point(0)<=200)&(point(1)>=150)&(point(1)<=200) ^ chkcode){
chkcode^=1
if chkcode:mes "2個目"
}
await 10

goto *loops
stop

*e
mmstop : end

*messe
mes 22
goto*loops


このソースをもっと簡潔にできませんか?

できるかた伝授お願いします。



この記事に返信する


EFGH

リンク

2013/9/13(Fri) 10:38:47|NO.57116

すみません

余計なものが入っていましたのではぶきました


#uselib "user32.dll"
#func GetCursorPos "GetCursorPos" int
#func ScreenToClient "ScreenToClient" int,int
screen 0,640,480,0
color 0,0,0 :boxf 50,50,100,100
color 0,0,0 :boxf 150,150,200,200

dim point,2
*loops
GetCursorPos varptr(point)
ScreenToClient hWnd,varptr(point)
if ((point(0)>=50)&(point(0)<=100)&(point(1)>=50)&(point(1)<=100) ^ chkcode){
chkcode^=1
if chkcode:mes "1個目"
await 10
}
if ((point(0)>=150)&(point(0)<=200)&(point(1)>=150)&(point(1)<=200) ^ chkcode){
chkcode^=1
if chkcode:mes "2個目"
}
await 10

goto *loops
stop



こちらです

よろしくお願いします



fortunehill

リンク

2013/9/13(Fri) 10:59:48|NO.57117

/*こんな感じで良いのかな?*/

color 0,0,0 :boxf 50, 50,100,100 color 0,0,0 :boxf 150,150,200,200 dim point,2 *loops point = mousex,mousey if (point(0)>= 50)and(point(0)<=100)and(point(1)>= 50)and(point(1)<=100) {chkcode = 1} else:if (point(0)>=150)and(point(0)<=200)and(point(1)>=150)and(point(1)<=200) {chkcode = 2} else {chkcode = 0} if (chkcode) {title strf("%d個目",chkcode)} else {title "無選択"} await 10 goto *loops stop



あり

リンク

2013/9/13(Fri) 11:59:57|NO.57118

【番外編】
こういう方法もあるという事で・・・

screen 0,640,480,0 color 1,0,0 : boxf 50,50,100,100 color 2,0,0 : boxf 150,150,200,200 buffer 1 : celput 0, 0 *loops mx = mousex : my = mousey gsel 1 pget mx,my : r = ginfo_r gsel 0 m = "無選択" if r ! 255 : m = "" + r + "個目" title m await 10 goto *loops stop



EFGH

リンク

2013/9/13(Fri) 16:06:40|NO.57120

こんなに短いソースありがたいです!

是非使わせていただきます!



ONION software Copyright 1997-2023(c) All rights reserved.