我正在尝试使用
npm install steam
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误说
我不知道如何解决这个问题,我已经在两个不同的npm安装东西上得到了这个.我可以安装一些.
我尝试过:安装它需要的任何依赖项.(ursa,node-gyp等)安装Visual C++ 2005.安装Visual C++ 2010.将环境变量路径更改为/ VC /(在另一个StackOverflow线程/问题上找到.Google,googled和googled.
我也尝试做错误:
npm install ursa
Run Code Online (Sandbox Code Playgroud)
错误是:
如果有人能帮助我,请提前谢谢.
好吧,我只是在玩一个GreaseMonkey的用户脚本,这里只是我试图做的简单事情;
function test() {
document.getElementById('elementhere').innerHTML = 'test';
}
document.onload = test();
Run Code Online (Sandbox Code Playgroud)
它可以工作,如果我去我想要使用它的页面并执行"运行"或"重新加载和运行" - 但它不会自动运行,我试图通过使用document.onload来完成它.
基本上我想制作一个服务器然后一个简单的javascript网站与phaser尝试一些东西,但html的东西显示,但不是javascript.
这是我的不同文件和代码:
index.html的:
<!doctype html>
<html>
<center>
<body>
test
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="phaser.min.js"></script>
<script src="game.js"></script>
<div id='game'></div>
</body>
</center>
</html>
Run Code Online (Sandbox Code Playgroud)
game.js:
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'game', { preload: preload, create: create, update: update });
function preload() {
game.load.image('char', 'char.png');
}
var sprite;
var cursors;
function create() {
game.physics.startSystem(Phaser.Physics.P2JS);
game.physics.p2.defaultRestitution = 0.8;
sprite = game.add.sprite(200, 200, 'char');
game.physics.p2.enable(sprite);
sprite.body.setZeroDamping();
sprite.body.fixedRotation = true;
text = game.add.text(20, 20, 'l2arrowkeys', { fill: '#ffffff' });
cursors = game.input.keyboard.createCursorKeys();
}
function update() { …
Run Code Online (Sandbox Code Playgroud) 我如何计算数组中有多少个对象?
该数组看起来像:
[ {id: 1}, {id: 2}, ...]
Run Code Online (Sandbox Code Playgroud)
我假设我可以使用count(),如果它是PHP,但NodeJS/Javascript怎么样?
编辑:
if (offer.items_to_receive.length > 0) {
console.log("items: " + offer.items_to_receive.length);
for(var i = 0; i < offer.items_to_receive.length; i++) {
usersInRound.push(offer.steamid_other);
}
}
logData('Accepted trade offer from ' + offer.steamid_other + '. (tradeofferid: ' + offer.tradeofferid + ')\nWorth ' + offer.items_to_receive.length + ' tickets. ');
Run Code Online (Sandbox Code Playgroud)
怎么会看到"值得X门票",而不是其他部分?
我正在试图弄清楚如何自动接受朋友请求,因为我真的很无聊我已经在这里和那里开始做一些机器人我已经开始了.
这里有两个有用的链接:
https
:
//github.com/seishun/node-steam/blob/master/README.md#relationships
https://github.com/seishun/node-steam/blob/master/README.md#朋友
所以我一直试图弄清楚如何通过使用它来自动接受朋友请求.
目前有一个待处理的好友请求,我很好奇我将如何让它自动接受它,甚至打印当前的好友请求.
这是我关于@ node-steam自述文件的"朋友"活动,看起来像.
在"朋友"活动下,它说如下:
The friends and groups properties now contain data (unless your friend/group list is empty). Listen for this if you want to accept/decline friend requests that came while you were offline, for example.
Run Code Online (Sandbox Code Playgroud)
我很好奇我将如何访问这两个属性?对不起,如果这是一个愚蠢的问题.提前谢谢,我还在学习.:3
我已经确定我做错了但是我已经在这里待了很长时间并试图弄明白,但我做不到.如果有多个朋友请求,我的"朋友"事件将无法工作,因为它需要通过所有现有的事件,但我仍然不确定如何做到这一点.编辑; 我刚试过这个:
它目前至少有一个朋友请求,但它没有对此作出反应,所以我认为'朋友'事件是错误的?
编辑2; 我需要使用'人际关系'活动,而不是'朋友'.现在我只需要弄清楚如何查看所有当前的朋友请求.
我也发现了这个枚举:
Steam.EFriendRelationship = {
None: 0,
Blocked: 1,
PendingInvitee: 2, // obsolete - renamed to RequestRecipient
RequestRecipient: 2,
Friend: 3,
RequestInitiator: 4,
PendingInviter: 4, // obsolete - renamed to RequestInitiator
Ignored: …
Run Code Online (Sandbox Code Playgroud) 这是我目前的课程:
package Mathias;
import java.util.*;
public class Scanner {
public static void main(String args[]) {
System.out.print("What's your name?");
Scanner sc = new Scanner(System.in);
String Input = sc.nextLine();
System.out.println("Hello, " + Input + ".");
}
}
Run Code Online (Sandbox Code Playgroud)
我在第5和第6行遇到两个错误.
错误1 http://puu.sh/64VGk.jpg
所以这就是我到目前为止所做的:
<script>
text = new Array("t", "te", "tes", "test");
for(new i; i < text.length; i++)
{
document.getElementById('text').innerHTML=text[i];
}
</script>
<body>
<span id='text'></span>
</body>
Run Code Online (Sandbox Code Playgroud)
我稍后会添加一个计时器,但我的问题是,为什么我得到"ReferenceError'i'未定义"?它被定义为你可以看到..提前谢谢.
这是我到目前为止所做的:
<div id='test'>
</div>
<script src='http://code.jquery.com/jquery-latest.js'></script>
<script>
var timePerLetter = 2000;
var newLineCharacter = '|';
function printOut(text) {
for(var i = 0; i < text.length; i++) {
var CHAR = text[i];
switch(CHAR) {
case newLineCharacter:
setTimeout( $('#test').append('<br>'), timePerLetter);
default:
setTimeout( $('#test').append(CHAR), timePerLetter);
}
}
}
printOut("HELLO ASDA| SD");
</script>
Run Code Online (Sandbox Code Playgroud)
它有点打印出来.它打印:
HELLO ASDA
| SD
Run Code Online (Sandbox Code Playgroud)
但是,它并没有等待每封信两秒钟我怎样才能解决这个问题?