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


HSPTV!掲示板


未解決 解決 停止 削除要請

2008
1218
CEO通信について2解決


CEO

リンク

2008/12/18(Thu) 17:27:58|NO.21698

ちょっとお聞きしたいのですが、P2Pのミニゲームをつくっているのですが、
結果が正しく表示されなくて、困っております。どなたかご指摘をしていただけないでしょうか

#include "hspsock.as" title "ボタン連打対戦" port=12345 ;ポート設定 ipget ;ローカルIP取得 ip=refstr dim sock_num,2 sock_num(0)=0 sock_num(1)=1 cls button "ホスト",*host button "接続する",*client mes "IP" mes ip mes "ポート" mes port mes "接続先IP" input ip,150,20 mes "接続先ポート" input port,150,20 stop *host cls sockmake 0,port if stat!0:goto *error mes "Wait..." mynum=0 repeat sockwait sock_num(mynum) if stat>=2:goto *error if stat=0:goto *main wait 1 loop *client mynum=1 sockopen sock_num(mynum),ip,port if stat!0:goto *error goto *main *main cls color 192,192,192:boxf font msgothic,16 color 0,0,0 timer=100 mes "Wait..." wait 200 *main2 redraw 0 color 192,192,192:boxf font msgothic,16 color 0,0,0 pos 0,0 button "GO!",*kaio mes "残り時間:"+timer mes ""+kai+"回" redraw 1 await 100 timer=timer-1 if timer<0 : goto *finish goto *main2 stop *kaio kai+1 goto*main2 stop *finish color 192,192,192:boxf font msgothic,16 color 0,0,0 mes "終了!" wait 100 mes "判定中...." *out sockput "+kai+",sock_num(mynum) if stat!0:goto *error *check   sockcheck sock_num(mynum) if stat>=2:goto *error if stat=0:goto *receive await 50 goto *check *receive temp="" ;データ受け取り変数 sockget temp,128,sock_num(mynum) if stat!0:goto *error if temp="":goto *error *okk color 192,192,192:boxf font msgothic,16 color 0,0,0 mes "結果" wait 100 mes "自分"+kai+"" mes "あいて"+temp+" stop *error end



この記事に返信する


Ve

リンク

2008/12/18(Thu) 17:49:45|NO.21700

*out
sockput str(kai),sock_num(mynum)
if stat!0:goto *error


"+kai+" を str(kai) にしたら正しく結果が送られますね。



CEO

リンク

2008/12/18(Thu) 17:58:18|NO.21701

Veさんありがとうございました!
正しく表示されました



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