วิธีการใช้สคริปต์บน BlueStacks 5

บทความนี้จะช่วยได้อย่างไร?

คุณสามารถใช้งานสคริปได้ โดยจะทำให้สามารถกระทำแอคชั่นต่าง ๆ เช่น การกดปุ่ม คลิกเมาส์ ดีเลย์และอื่น ๆ ได้ โดยขึ้นอยู่กับการกำหนดของคุณ ว่าจะให้คีย์ไหนเป็นตัวเริ่มการทำงาน

โดยการใช้สคริปนั้น คุณจะสามารถเพิ่มประสิทธิภาพให่กับการควบคุมคีย์ต่าง ๆ เพื่อเป็นการส่งเสริมประสบการณ์การเล่นเกมของคุณสู่อีกขั้นและคุณสามารถกำหนดปุ่มให้มันได้ด้วย

บทความนี้จะแนะนำการใช้งานสคริปต์อย่างมีประสิทธิภาพ:


คำสั่งที่ใช้ในการรันสคริปบน BlueStacks

Commands available for scripts on BlueStacks

Keyword Syntax Short Description
# # this is a comment Comments begin with #. Everything until the end of the line is considered a comment and is ignored.

A comment can be on a line by itself or can be placed at the end of a command on the same line.
keyDown keyDown key

e.g.
keyDown TAB
Key is pressed and is not released until the keyup command is encountered for the same key.

Mapping for the key is executed if one exists. Otherwise, the keyDown input is forwarded to android.
keyDown2 keyDown2 key

e.g.
keyDown2 TAB
Key is pressed and is not released until the keyUp is encountered for the same key.

Mapping is not executed and key down input is forwarded to android.
keyUp keyUp key

e.g.
keyup TAB
Key is released. Mapping is executed if one exists; otherwise, keyUp input is forwarded to android.
keyUp2 keyup2 key

e.g.
keyup2 TAB
Key is released. Mapping is not executed and keyUp input is forwarded to android.
mouseDown mouseDown x y

e.g.
mouseDown 44.0 55.5
The left button of the mouse is pressed at location x, y. All locations are in screen percentages so that the same script can work across different resolutions.
mouseUp mouseUp The left button of the mouse is released. No coordinates are required.
mouseMove mouseMove x y

e.g.
mouseMove 4.56 5.67
Mouse moves to new location x, y
touch touch x1 y1 x2 y2 x3 y3

e.g.
# 3 fingers
touch 4 5 6 7 8 9

# 3rd finger lifted
touch 4 5 6 7

# fingers 1 and 2 move
touch 5 6 7 8

# fingers 1 and 2 lifted
touch
Touch input with the current set of touchpoints specified. Series of touch commands can be used to create arbitrary multi-touch input.

Up to 16 touchpoints are supported. But keep in mind that other touchpoints from other controls are aggregated before sending to android.
text text “text”
text backspace 2
e.g.
text “hello world”
Send text input to android. This can be in any language. The format should be utf8.
mouseWheel mouseWheel x y d
mouseWheel 44.0 55.5 1
mouseWheel 44.0 55.5 -1
Send mousewheel event to keymapping which will convert it to zoom or scroll accordingly
wait wait msecs

e.g.
wait 24
Waits for the specified number of milliseconds before executing the next command.


Higher Level Primitives

Keyword Syntax Short Description
onMouseMove onMouseMove

This provides finer control over execution of script.  Different sets of commands can be provided for executing when the mouse is moved.

Commands following the onMouseMove command are executed when the trigger key is pressed and the mouse cursor is moved

abort  abort


It aborts the execution of a script.  

onRelease

onRelease


This provides finer control over the execution of the script. A different set of commands can be provided for executing when the trigger key is pressed and released.

All commands from the top of the script until the onRelease command are executed for as long as the trigger key is pressed.

Commands following the onRelease command are executed when the trigger key is released.

 

dTouch

 

onMouseMove

dTouch x+a y+b x+c y+d… x+u x+v

 

# take two touch points x+3 y x-3 y

dTouch x+3 y x-3 y

onRelease

abort

The dTouch command is specific to the mouse movement. Hence, it is necessary to use onMouseMove command at the start of the script.

dTouch can be used to make a touch gesture on-screen with offset to current mouse location x y. Multiple points may be specified to generate the touch point.

a,b,c,d are offsets of the touch points from the current mouse location x y.

onRelease abort command ensures that the script stops as soon as the trigger key is released.

tap tap x1 y1 x2 y2 … xn yn delay

This does a tap gesture. Single or multiple touchpoints can be specified. The touchpoint(s) are held for a specified delay. If the delay is not specified it is assumed to be 50msec.

Delay is specified in milliseconds. This is the amount of time the entire swipe gesture takes.

Up to 16 touchpoints are supported. But keep in mind that other touchpoints from other controls are aggregated before sending to android.

swipe swipe x1 y1 x2 y2 … xn yn delay

e.g.
# swipe 4,5 to 40,45
# take 100msecs
swipe 4 5 40 45 100
Do a swipe gesture. Multiple points may be specified which the swipe goes through.

Delay is specified in milliseconds. This is the amount of time the entire swipe gesture takes.
loop / loopEnd

loop n
.
.
loopEnd

onRelease

abort

Commands following loop command until loopEnd are executed n times.

If n is not specified, the loop continues indefinitely or until the script trigger key is released.

The onRelease abort command ensures that the script stops running when the trigger key is released.

enterShoot enterShoot Enter shooting mode used to play FPS games. If a Pan control does not exist in the current scheme this is ignored. If shooting mode is already enabled this has no effect.
exitShoot exitShoot Exit shooting mode. If a Pan control does not exist in the current scheme this is ignored. If shooting mode is disabled this is ignored.
toggleShoot toggleShoot Toggle shooting mode. If a Pan control does not exist in the current scheme this is ignored.

 


จะใช้งานคริปได้อย่างไร?

1. เปิดเกมบน BlueStacks ที่ต้องการจะใช้งานสคริป

Screenshot_50.png

2. จากนั้นคลิกไอคอน "Game controls" จาก Side Toolbar และเลือก "Open advanced editor" จากเมนู
ดรอปดาวน์

1.png

3. เมื่อต้องการสร้างสคริป ลากปุ่มสคริปและวางที่พื้นที่การใช้งาน เพื่อการอธิบาย เราจะวางปุ่ม Bag ลงในปุ่มซ้ายตามรูปด้านล่าง

1.gif

4. จากนั้นกำหนดให้ปุ่มนี้ทำงานด้วยปุ่ม "Tab" เพื่อเป็นการเปิดการใช้งาน

2.png

5. คลิกที่ไอคอน "<\>" ใต้ปุ่มสคริปเพื่อเริ่มป้อนคำสั่งให้สคริปนี้

3.png

6. จากนั้นคลิกขาวที่จุดบนหน้าจอภายในเกมที่คุณจะสามารถเพิ่มสคริปได้ ในปุ่ม Bag ตามรูปด้านล่าง

4.png

หลังจากคลิกขวาบนหน้าจอเรียบร้อยแล้ว การทำงานจะเริ่มขึ้นและจะแสดงบน  Script editor พี่บริเวณด้านขวาของหน้าจอ ตามรูปภาพด้านล่าง

5.png

7. คุณสามารถเพิ่มคำสั่งสคริปที่อยู่ติดกับ Script editor ได้ตามรูปด้านล่าง

  • คำสั่ง "tap" จะแสดงว่าเมื่อเรากด CapsLock ปุ่ม Bag จะทำงาน 1 ครั้ง
  • คำสั่ง "exitShoot" จะแสดงว่าเมื่อเรากดปุ่ม CapsLock จะเป็นการปรับโหมดการยิ่งภายในเกม

หลังจากป้อนคำสั่งเรียบร้อย คลิก "Done"

6.png

8. จากนั้นคลิก "Save" จากนั้นคุณจะสามารถเปิด Controls Editor ได้

7.png

9. คุณจะพบความเปลี่ยนแปลงภายในเกม

ภาพประกอบด้านล่างเป็นการแสดงถึงการปรับโหมดการยิงด้วยการกดปุ่ม Tab ปุ่ม Bag จะถูกเปิดใช้งานและเป็นการออกจากโหมดการยิง

2.gif


ขอบคุณที่ใช้งาน BlueStacks เราหวังว่าจะชอบ เล่นเกมให้สนุกนะ!

บทความนี้มีประโยชน์หรือไม่
386 จาก 717 เห็นว่ามีประโยชน์
Reach out to us on Reddit (Join Reddit) or Discord (Join Discord) or at support@bluestacks.com with your questions.

We’d love to hear from you! Please take a moment to share your thoughts on the BlueStacks Help Center via this survey.
Subscribe to BlueStacks Weekly!
Get updates on new releases, features, and fixes. Discover trending games & enjoy exclusive gift codes!
By subscribing, I agree to receive weekly updates from the BlueStacks Help Center.
Thank you for subscribing to BlueStacks Weekly
Keep an eye on your inbox for updates on the latest features, gaming trends, bug fixes, gift codes, and much more!