我想过滤掉老虎机的模式,在这种情况下,如果它们具有相同的值,我希望选择以下索引.
如果应该输出索引0,2和6具有相同的值.我在想像函数调用这样的东西
if (win_filter([0, 2, 6] == "slot-2") {
console.log("You won");
}
Run Code Online (Sandbox Code Playgroud)
我的代码如下.
var final_score = new Array();
$(".shoot").click(function() {
//var numbers_array = ["slot-1", "slot-1", "slot-1", "slot-1", "slot-1", "slot-2", "slot-2", "slot-2", "slot-2", "slot-3", "slot-3", "slot-3", "slot-4", "slot-4", "slot-5"];
var numbers_array = ["slot-1", "slot-2", "slot-3", "slot-4", "slot-5"];
var target = $("div.window table");
target.find("tr td > div").each(function() {
$(this).fadeOut(function() {
$(this).removeAttr('class');
$(this).addClass(numbers_array[Math.floor(Math.random() * numbers_array.length)]);
$(this).fadeIn();
final_score.push($(this).attr("class"));
});
});
function filterResults(arr) {
return final_score.filter(function(el) {
return arr.some(function(e) {
return el.timeframe == e;
}); …Run Code Online (Sandbox Code Playgroud) 所以我试图在给定区域的屏幕中间找到某种模式.我正在使用AutoItX库和PixelSearch方法.
它没有返回已发现的模式,但如果我调整矩形的绳索,0, 0则表明已找到该模式.
使用以下脚本:
public void MonsterScan()
{
if(SixStarMax() == true)
{
Console.WriteLine("Pattern found");
}
}
public bool SixStarMax()
{
Rectangle rect = new Rectangle(1980, 630, 1240, 180);
autoSumPoint = AutoItX.PixelSearch(rect, 0xF8F0E0); // 0xF8F0E0
autoSumPoint2 = AutoItX.PixelSearch(rect, 0xB7AD9F); // 0xB7AD9F
autoSumPoint3 = AutoItX.PixelSearch(rect, 0xCDC6B8); // 0xCDC6B8
autoSumPoint4 = AutoItX.PixelSearch(rect, 0x949084); // 0x949084
if (rect.Contains(autoSumPoint2) == true && rect.Contains(autoSumPoint2) == true && rect.Contains(autoSumPoint3) == true && rect.Contains(autoSumPoint4) == true)
{
AutoItX.MouseMove(autoSumPoint.X, …Run Code Online (Sandbox Code Playgroud) 所以我遇到了一个问题,我正在尝试将密钥发送到游戏中,并且我将游戏放在前台,SetForegroundWindow并且我正在使用SendInputsAPI将密钥发送到游戏中.
如果我专注于另一个应用程序,密钥将被发送到该应用程序,但只要我专注于我想要发送密钥的应用程序,它们就不会出现在那里.
我想节省一些时间为我的公会招募公会成员,并且我正试图将钥匙发送给游戏.
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
static extern IntPtr GetMessageExtraInfo();
[DllImport("user32.dll", SetLastError = true)]
static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
Process[] procs = Process.GetProcessesByName("BlackDesert64");
if (procs.Length > 0)
{
if (procs[0].MainWindowHandle != IntPtr.Zero)
{
SetForegroundWindow(procs[0].MainWindowHandle);
Thread.Sleep(1000);
}
}
INPUT[] inputs = new INPUT[]
{
new INPUT
{
type = INPUT_KEYBOARD,
u = new InputUnion
{
ki = new KEYBDINPUT
{
wVk = 0x49,
wScan = 0049,
dwFlags = …Run Code Online (Sandbox Code Playgroud) 我有一个非常基本的问题,我如何使用百分比减法?更重要的是,甚至还有一个吗?jQuery减法的页面是什么?我似乎找不到一个。
我想做的是一个简单的任务,但是却不知道要减去百分比,所以我做不到。
我使用data-val的div存储值,像HTML我有data-val="10"
10等于10%,那么我该如何使jQuery将的10 data-val减去它呢?
<td width="200">Discount:</td>
<td width="100" align="right" class="discount" data-val="10">-29,8 kr</td>
Run Code Online (Sandbox Code Playgroud)
使用以下jQuery代码。
jQuery(document).ready(function($){
$('#cart_review .quantity').change(function (event) {
$quan = $(this);
console.log($quan.parent().next()[0]);
$quan.parent().next().find('.price').text(function () {
return $quan.val() * parseInt($(this).attr('data-val'), 10) + ' kr';
});
var total = 0;
$('#cart_review .price').each(function(k, v){
total += parseFloat($(v).text(), 10);
});
$('.products').text(function() {
return total + ' kr';
});
var shipping = 0;
$('.shipping').text(function () {
shipping = parseInt($(this).attr('data-val'), 10);
return $(this).attr('data-val' + ' kr');
}); …Run Code Online (Sandbox Code Playgroud)