と、思ったのですが、今試してみたところ、その方法ではエラーが出るので、新しい方法を考えました。
access.txtというファイルが存在するときは豆乳、存在しないときはHSPが処理をします。
HSP側
screen 0, 300, 100
title "コントローラー"
mes "←↑↓→:移動"
repeat
stick Key, 1 + 2 + 4 + 8, 0
notesel CharPos
CharPos = "" + Key
repeat
exist "access.txt"
if strsize >= 0 {
notesave "pos.txt"
delete "access.txt"
break
}
await 0
loop
await 1
loop
豆乳側
extends DxChar;
while(1){
//ファイルからキーの状態を入力
if ( fileExists( "access.txt" ) == 0 ) {
pos= new FileReader("pos.txt");
l = valueOf( pos.readLn() );
Key = l;
if ( Key == 1 ) AddX = -1;
if ( Key == 4 ) AddX = 1;
if ( Key != 1 && Key != 4 ) AddX = 0;
if ( Key == 2 ) AddY = -1;
if ( Key == 8 ) AddY = 1;
if ( Key != 2 && Key != 8 ) AddY = 0;
pos.close();
//ファイルの操作が終わったことを示すファイルを出力
access = new FileWriter( "access.txt" );
access.writeLn(1);
access.close();
}
//座標更新
X += AddX;
Y += AddY;
update();
}