座標自動維持ボタン(離席用)
by
cutfloss
05/03 [2026/05/03 22:36:02]
押すとその場でグルグル回り続けるボタンが表示される
@@ -4,75 +4,70 @@
* @private
*/
javascript:(function(){
- /* すでにボタンがある場合は重複させない */
- if(document.getElementById('auto-rotate-btn')) return;
+ if(document.getElementById('afk-rotate-btn')) return;
- /* 1. ボタンの作成 */
+ /* 1. ボタン作成(誤タップ防止のため画面上部中央) */
const btn = document.createElement('button');
- btn.id = 'auto-rotate-btn';
+ btn.id = 'afk-rotate-btn';
btn.innerHTML = '🌀 ぐるぐる OFF';
- /* 誤タップしにくい上の方に配置 */
Object.assign(btn.style, {
position: 'fixed',
- top: '10px',
+ top: '15px',
left: '50%',
transform: 'translateX(-50%)',
- zIndex: '9999',
- padding: '8px 15px',
- backgroundColor: '#333',
+ zIndex: '10000',
+ padding: '10px 20px',
+ backgroundColor: 'rgba(15, 23, 42, 0.9)',
color: '#fff',
- border: '2px solid #fff',
- borderRadius: '20px',
+ border: '2px solid #334155',
+ borderRadius: '25px',
fontSize: '14px',
fontWeight: 'bold',
- cursor: 'pointer'
+ cursor: 'pointer',
+ boxShadow: '0 4px 15px rgba(0,0,0,0.5)'
});
document.body.appendChild(btn);
- /* 2. 旋回ロジックの変数 */
let rotateInterval = null;
let step = 0;
- /* 上(0), 右(1), 下(2), 左(3) の方向ベクトル */
- const directions = [
- {dx: 0, dy: -100}, /* 上 */
- {dx: 100, dy: 0}, /* 右 */
- {dx: 0, dy: 100}, /* 下 */
- {dx: -100, dy: 0} /* 左 */
+ /* 上・右・下・左 の方向ベクトル */
+ const dirs = [
+ {x: 0, y: -1}, {x: 1, y: 0}, {x: 0, y: 1}, {x: -1, y: 0}
];
- /* 3. ぐるぐる実行関数 */
- const toggleRotate = () => {
+ const toggle = () => {
if (rotateInterval) {
- /* 停止処理 */
clearInterval(rotateInterval);
rotateInterval = null;
btn.innerHTML = '🌀 ぐるぐる OFF';
- btn.style.backgroundColor = '#333';
- /* 入力をリセット */
- if(window.inputState) {
- window.inputState.dx = 0;
- window.inputState.dy = 0;
- window.inputState.drawing = false;
+ btn.style.borderColor = '#334155';
+ /* 停止時は入力をリセット */
+ if(typeof inputState !== 'undefined') {
+ inputState.dx = 0;
+ inputState.dy = 0;
+ inputState.drawing = false;
+ if(typeof sendInput === 'function') sendInput();
}
} else {
- /* 開始処理 */
- btn.innerHTML = '🌀 ぐるぐる ON!';
- btn.style.backgroundColor = '#f00';
+ btn.innerHTML = '🌀 ぐるぐる稼働中!';
+ btn.style.borderColor = '#22c55e'; /* 稼働中は緑に */
rotateInterval = setInterval(() => {
- if (window.inputState) {
- window.inputState.drawing = true;
- const dir = directions[step % 4];
- window.inputState.dx = dir.dx;
- window.inputState.dy = dir.dy;
+ if (typeof inputState !== 'undefined' && typeof sendInput === 'function') {
+ const d = dirs[step % 4];
+ /* 1. 入力値を書き換え */
+ inputState.dx = d.x;
+ inputState.dy = d.y;
+ inputState.drawing = true;
+
+ /* 2. ゲーム側の送信ロジックを発火させる */
+ sendInput();
+
step++;
- /* 内部の送信関数があれば呼ぶ(即時反映のため) */
- if(typeof sendInput === 'function') sendInput();
}
}, 200); /* 0.2秒刻み */
}
};
- btn.onclick = toggleRotate;
- console.log('離席用ぐるぐるパッチ:インストール完了');
-})();
-
+ btn.onclick = toggle;
+ console.log('Rotate Script Active: Logic sync with client-game.js');
+})();
/*
* @title 座標自動維持ボタン(離席用)
* @description 押すとその場でグルグル回り続けるボタンが表示される
* @private
*/
javascript:(function(){
if(document.getElementById('afk-rotate-btn')) return;
/* 1. ボタン作成(誤タップ防止のため画面上部中央) */
const btn = document.createElement('button');
btn.id = 'afk-rotate-btn';
btn.innerHTML = '🌀 ぐるぐる OFF';
Object.assign(btn.style, {
position: 'fixed',
top: '15px',
left: '50%',
transform: 'translateX(-50%)',
zIndex: '10000',
padding: '10px 20px',
backgroundColor: 'rgba(15, 23, 42, 0.9)',
color: '#fff',
border: '2px solid #334155',
borderRadius: '25px',
fontSize: '14px',
fontWeight: 'bold',
cursor: 'pointer',
boxShadow: '0 4px 15px rgba(0,0,0,0.5)'
});
document.body.appendChild(btn);
let rotateInterval = null;
let step = 0;
/* 上・右・下・左 の方向ベクトル */
const dirs = [
{x: 0, y: -1}, {x: 1, y: 0}, {x: 0, y: 1}, {x: -1, y: 0}
];
const toggle = () => {
if (rotateInterval) {
clearInterval(rotateInterval);
rotateInterval = null;
btn.innerHTML = '🌀 ぐるぐる OFF';
btn.style.borderColor = '#334155';
/* 停止時は入力をリセット */
if(typeof inputState !== 'undefined') {
inputState.dx = 0;
inputState.dy = 0;
inputState.drawing = false;
if(typeof sendInput === 'function') sendInput();
}
} else {
btn.innerHTML = '🌀 ぐるぐる稼働中!';
btn.style.borderColor = '#22c55e'; /* 稼働中は緑に */
rotateInterval = setInterval(() => {
if (typeof inputState !== 'undefined' && typeof sendInput === 'function') {
const d = dirs[step % 4];
/* 1. 入力値を書き換え */
inputState.dx = d.x;
inputState.dy = d.y;
inputState.drawing = true;
/* 2. ゲーム側の送信ロジックを発火させる */
sendInput();
step++;
}
}, 200); /* 0.2秒刻み */
}
};
btn.onclick = toggle;
console.log('Rotate Script Active: Logic sync with client-game.js');
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。