Hello stackoverflow我需要你帮助我尝试制作一个脚本。 我试图制作的脚本是一个执行以下操作的cointoss脚本。
我希望它做的第一部分是插入我想要玩的金额。
如果我赢得与第一次下注相同的值并将我的数据源设置回第一行。
如果我松散使用数据源插入新值并重新播放。
以下是我的想法:
Cointoss.js
VERSION BUILD=8920312 RECORDER=FX
SET !DATASOURCE cointoss25.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
if(iimPlay(WIN.iim)>0)
{
iimPlay(WINPLAY.iim)
}
else if(iimPlay(LOOSE.iim)>0)
{
iimPlay(LOOSEPLAY.iim)
}
WIN.iim脚本
SEARCH SOURCE=TXT:"You guessed right! You win"
WINPLAY.iim脚本
TAG POS=1 TYPE=A ATTR=TXT:PLAY<SP>AGAIN
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:bet CONTENT=25
TAG POS=1 TYPE=IMG ATTR=SRC:http://www.paidverts.com/assets/images/games/coin_flip/heads.gif
SET !DATASOURCE_LINE 1
LOOSE.iim脚本
SEARCH SOURCE=TXT:"You guessed wrong. Try again!"
LOOSEPLAY.iim脚本
TAG POS=1 TYPE=A ATTR=TXT:PLAY<SP>AGAIN
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:bet CONTENT={{!COL1}}
TAG POS=1 TYPE=IMG ATTR=SRC:http://www.paidverts.com/assets/images/games/coin_flip/heads.gif
问题是我一直收到这个错误:
SyntaxError: missing ; before statement, line NaN (Error code: -991)
答案 0 :(得分:0)
我建议'Cointoss.js'的变体是这样的:
var M;
const L = "\n";
var maxLoop = 5; // your value here
for (loop = 1; loop <= maxLoop; loop++) {
M = "SET !DATASOURCE cointoss25.csv" + L;
M += "SET !DATASOURCE_LINE " + loop + L;
iimPlayCode(M);
if (iimPlay(WIN.iim) > 0)
iimPlay(WINPLAY.iim);
else if (iimPlay(LOOSE.iim) > 0)
iimPlay(LOOSEPLAY.iim);
}
答案 1 :(得分:0)
它帮助了我很多,但仍然需要改变很多(进入一个脚本文件)
现在我从数据源插入数据时遇到了一些问题,但似乎无法正常工作。
var MaxLoops = 50;
var TossLoop;
var HeadsIMG;
var TailsIMG;
var StartIMG;
HeadsIMG = "IMAGESEARCH POS=1 IMAGE=Heads.png CONFIDENCE=95 \n";
TailsIMG = "IMAGESEARCH POS=1 IMAGE=Tails.png CONFIDENCE=95 \n";
StartIMG = "IMAGESEARCH POS=1 IMAGE=Start.png CONFIDENCE=95 \n";
FirstPlay = "TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:bet CONTENT=25 EXTRACT=TXT \n";
FirstPlay += "WAIT SECONDS=4 \n";
FirstPlay += "TAG POS=1 TYPE=IMG ATTR=SRC:http://www.paidverts.com/assets/images/games/coin_flip/heads.gif \n";
FirstPlay += "WAIT SECONDS=4 \n";
FirstPlay += "SET !DATASOURCE_LINE 1 \n";
WinPlay = "TAG POS=1 TYPE=A ATTR=TXT:PLAY<SP>AGAIN \n";
WinPlay += "WAIT SECONDS=4 \n";
WinPlay += "TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:bet CONTENT=25 EXTRACT=TXT \n";
WinPlay += "WAIT SECONDS=4 \n";
WinPlay += "TAG POS=1 TYPE=IMG ATTR=SRC:http://www.paidverts.com/assets/images/games/coin_flip/heads.gif \n";
WinPlay += "WAIT SECONDS=4 \n";
WinPlay += "SET !DATASOURCE_LINE 1 \n";
LoosePlay = "TAG POS=1 TYPE=A ATTR=TXT:PLAY<SP>AGAIN \n";
LoosePlay += "WAIT SECONDS=4 \n";
LoosePlay += "TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:bet CONTENT={{!COL1}} \n";
LoosePlay += "WAIT SECONDS=4 \n";
LoosePlay += "TAG POS=1 TYPE=IMG ATTR=SRC:http://www.paidverts.com/assets/images/games/coin_flip/heads.gif \n";
for (loop = 1; loop <= MaxLoops; loop++) {
TossLoop = "SET !DATASOURCE CoinToss25.csv" + "\n";
TossLoop += "SET !DATASOURCE_COLUMNS 1" + "\n";
TossLoop += "SET !DATASOURCE_LINE " + loop + "\n";
iimPlayCode(TossLoop);
if (iimPlayCode(StartIMG) > 0)
iimPlayCode(FirstPlay);
else if (iimPlayCode(HeadsIMG) > 0)
iimPlayCode(WinPlay);
else if (iimPlayCode(TailsIMG) > 0)
iimPlayCode(LoosePlay);
}