<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>鼠标宏 &#8211; from0to1</title>
	<atom:link href="https://www.from0to1.top/tag/%E9%BC%A0%E6%A0%87%E5%AE%8F/feed" rel="self" type="application/rss+xml" />
	<link>https://www.from0to1.top</link>
	<description>一个研究技术、分享经验的博客</description>
	<lastBuildDate>Tue, 21 Nov 2023 15:24:42 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>用python写一个基础压枪宏</title>
		<link>https://www.from0to1.top/250.html</link>
					<comments>https://www.from0to1.top/250.html#respond</comments>
		
		<dc:creator><![CDATA[雾朦Official]]></dc:creator>
		<pubDate>Tue, 21 Nov 2023 15:17:32 +0000</pubDate>
				<category><![CDATA[编程]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[游戏科技]]></category>
		<category><![CDATA[鼠标宏]]></category>
		<guid isPermaLink="false">https://www.from0to1.top/?p=250</guid>

					<description><![CDATA[首先要引用pyautogui，这个模块是控制鼠标动作的 import pyautogui 如果你的pyautogui模块没有安装则可以通过在终端运行pip命令安装 pip install pyautogui 然后再引用time模块，这个可以更好控制鼠标的动作时间 import time 首先是moveTo函数，这个函数是将鼠标移动到目标位置，用法如下，x，y都是像素 x=11 y=22 pyaut [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>首先要引用pyautogui，这个模块是控制鼠标动作的</p>
<pre class="prettyprint linenums">import pyautogui</pre>
<p>如果你的pyautogui模块没有安装则可以通过在终端运行pip命令安装</p>
<pre class="prettyprint linenums">pip install pyautogui</pre>
<p>然后再引用time模块，这个可以更好控制鼠标的动作时间</p>
<pre class="prettyprint linenums">import time</pre>
<p>首先是moveTo函数，这个函数是将鼠标移动到目标位置，用法如下，x，y都是像素</p>
<pre class="prettyprint linenums">
x=11
y=22
pyautogui.moveTo(x, y)</pre>
<p>这段代码的一丝就是将鼠标移动到电脑屏幕上（11，22）这个点</p>
<p>当然，我们鼠标如果只是可以移动这是不行的，我们还需要有点击的功能，更好得帮我们攻击敌人（如压连狙，连续点击会让自己分心）</p>
<p>左键单击</p>
<pre class="prettyprint linenums">pyautogui.click(button=&#039;left&#039;)</pre>
<p>右键单击</p>
<pre class="prettyprint linenums">pyautogui.click(button=&#039;right&#039;)</pre>
<p>左键右键同时单击</p>
<pre class="prettyprint linenums">pyautogui.click(button=&#039;left,right&#039;)</pre>
<p>下面是dragTo，这个函数就比较有意思了</p>
<p>将鼠标从当前位置开始，移动到（1，2），并按住鼠标左键，拖动速度为3，步长为4</p>
<pre class="prettyprint linenums">
x = 1
y = 2
z = 3
w = 4
pyautogui.dragTo(x, y, button=&#039;left&#039;, duration=z, steps=w)</pre>
<p>接下来是time模块的使用</p>
<p>首先是sleep函数的用法，可以让程序睡眠一段时间</p>
<p>如，程序睡眠三秒</p>
<pre class="prettyprint linenums">time.sleep(3)</pre>
<p>以及，获取程序的运行时间x</p>
<pre class="prettyprint linenums">

代码1

start_time = time.perf_counter()

代码2

end_time = time.perf_counter()

x = end_time - start_time

</pre>
<p>如果你能灵活运用以上几个函数，那么，你就可以自己写出一个压枪宏了，当然，这个过程非常麻烦</p>
<p>end</p>
<p>奶妈镇楼</p>
<p><img fetchpriority="high" decoding="async" src="https://www.from0to1.top/wp-content/uploads/2023/11/xinxia_mode.webp" alt="" class="alignnone size-full wp-image-251" srcset="https://www.from0to1.top/wp-content/uploads/2023/11/xinxia_mode.webp 1113w, https://www.from0to1.top/wp-content/uploads/2023/11/xinxia_mode-209x300.webp 209w, https://www.from0to1.top/wp-content/uploads/2023/11/xinxia_mode-712x1024.webp 712w, https://www.from0to1.top/wp-content/uploads/2023/11/xinxia_mode-768x1104.webp 768w, https://www.from0to1.top/wp-content/uploads/2023/11/xinxia_mode-1068x1536.webp 1068w" sizes="(max-width: 1113px) 100vw, 1113px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.from0to1.top/250.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
