QX云脚本
1. 按键精灵脚本如何适应不同的分辨率
游戏中的分辨率,和系统的屏幕分辨率,其实是两个东西。并不是你修改了系统屏幕分辨率为1920*1080,游戏的分辨率就会改成1920*1080。
当然有些游戏,你调整它的分辨率的时候,会相应的修改你的系统分辨率。但是这个并不是所有的游戏都这样流氓的。
游戏分辨率和系统屏幕分辨率区分:
图1-1920*1080分辨率下窗口的大小637.441
图2-1280*720分辨率下窗口的大小637.441
当游戏窗口固定的时候(游戏的分辨率固定时),你调整系统的屏幕分辨率,其实只是肉眼中图标变大了。实际上,游戏窗口的分辨率并没有变。
如上图,一个是系统分辨率1920*1080的屏幕分辨率,一个是1280*720的屏幕分辨率,看起来好像软件变大了。其实在软件这个窗口的大小是没有变的,只是视觉误差。从上图的客户区大小的数值就可以看出来。

游戏分辨率改变,游戏图标等比放大
解决方法:不同的分辨率各制作一套对应的图。调用各分辨率,相对应的图。
有些游戏,游戏分辨率修改之后,游戏界面图标会等比的放大缩小。这种情况,游戏图标大小会变,位置也会变。由于各个游戏商使用的图像处理引擎不尽相同,所以根据等比差来进行相对坐标计算是不实际的,这种情况,只能每种游戏分辨率都做一套游戏图标截图。
解决办法:霸王硬上弓,脚本直接修改游戏窗体分辨率,固定窗口大小。
2. 如何在windows中编写R程序包
在Windows环境下如何编写R程序包,即生成供linux环境编译运行的tar.gz文件,也生成供windows下使用的.zip文件呢?其实并不复杂,只要下载一些工具软件,按照相应的步骤填写相应的“表格”,继而运行一些简单的指令,就可以生成R的程序包了。
编写R程序包通常包括以下几步:
(1)       工具软件Rtools的安装和备选软件的安装。
(2)       r脚本的准备,也就是用来生成程序包的函数脚本。
(3)       利用R中自带的package.skeleton()函数,生成制作包所需要的Description 文件和帮助文件帮助文件.rd。
(4)       编辑该函数生成的Description 文件和帮助文件.rd
(5)       在windows cmd的命令行中输入相应的命令,生成zip文件或者.tar.gz
下面我们来一起建立只有一个函数的R程序包,来详细说明:
一 工具软件安装和配置
制作r包的工具软件包括Rtools,HTML编译器,MikTeX 或Cte等(备选软件不一定要安装):
1 工具软件安装
(1)Rtools(制作R包的主要工具)
Rtools是在windows下制作R包的一系列工具,其中包括
1)               CYGWIN 在Windows下模拟UNIX环境
2)               MinGW编译器,可用来编译C和Fortran语言。
3)               Perl
下载地址: http://www.murdoch-sutherland.com/Rtools/
(2) 微软HTML编译器(备选):
用来从源文件生成HTML格式的帮助文件
下载地址:http://go.microsoft.com/fwlink/?LinkId=14188
(3) MikTeX 或CteX(备选)
用来生成PDF格式的帮助文件
下载地址:http://www.miktex.org/     www.ctex.org/ 
分别按照要求安装好。 
2 设置文件启动路径:
我的电脑>属性>高级>环境变量>系统变量   PATH一项,点击“编辑”,检查是否具有以下路径,如果没有,需要手工添加:
c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin; C:\CTEX\MiKTeX\miktex\bin;C:\CTEX\CTeX\ctex\bin;C:\CTEX\CTeX\cct\bin;C:\CTEX\CTeX\ty\bin;C:\CTEX\Ghostscript\gs8.64\bin;C:\CTEX\GSview\gsview;C:\CTEX\WinEdt;C:\Program Files\R\R-2.9.0\bin\;
设置启动路径的目的是在cmd命令行可以直接调用相应的exe文件。
如果只是简单制作一个个人使用的包,只需将c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin; 添加到系统路径即可
二 R脚本的准备
假如现在我们已经有了一个编好的R函数,用来给出回归的精确结果,存成了r脚本的格式,文件名为linmod.r
其内容如下所示,那么该如何制作R程序包呢?
linmod<- function(x, y)
{
## compute QR-decomposition of x
qx <- qr(x)
## compute (x'x)^(-1) x'y
coef <- solve.qr(qx, y)
## degrees of freedom and standard deviation of resials
df <- nrow(x)-ncol(x)
sigma2 <- sum((y - x%*%coef)^2)/df
## compute sigma^2 * (x'x)^-1
vcov <- sigma2 * chol2inv(qx$qr)
colnames(vcov) <- rownames(vcov) <- colnames(x)
list(coefficients = coef,
vcov = vcov,
sigma = sqrt(sigma2),
df = df)
}
三 R包框架的准备
1 生成准备文件
登陆R :开始>所有程序>R>R.2.9.0
(1)清除内存中的对象:
rm(list=ls())
(2)设定工作目录,这里设定为 c:/pa
setwd("c:/pa")
(3)将制作包的源文件 linmod.r拷贝到c:/pa/文件夹下,
之后输入:
package.skeleton(name="linmod",code_files="c:/pa/linmod.r")
此时,R控制台中显示
Creating directories ...
Creating DESCRIPTION ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './linmod/Read-and-delete-me'.
> 
可以看到c:/pa文件夹下新出现了一个linmod文件夹
该文件夹下的内容就是R包的框架,包括data文件夹,man文件夹,只要按要求将其填写完整,再进行相应的编译即可。
首先查看Read-and-delete-me文件
文件内容如下:
* Edit the help file skeletons in 'man', possibly combining help
files for multiple functions.
* Put any C/C++/Fortran code in 'src'.
* If you have compiled code, add a .First.lib() function in 'R' to
load the shared library.
* Run R CMD build to build the package tarball.
* Run R CMD check to check the package tarball.
Read "Writing R Extensions" for more information.
大致意思如下:
可以man文件夹下编辑帮助文件
C/C++/Fortran 的源代码应该放入src文件夹下
需要在登录时载入包
可以运行R CMD建立和检查相应的包
查看更多信息,应该阅读Writing R Extensions
2 编辑Description文件和rd文件
(1) Description文件的编辑
按照提示,填好各项
Package: linmod
Type: Package
Title: test for linear regression
Version: 1.0
Date: 2009-07-20
Author: helixcn
Maintainer: helixcn <[email protected]>
Description: To give the exactly results of linear regression.
License: GNU 2 or later
LazyLoad: yes
(2)man文件夹中.rd文件编辑
man文件夹中包含两个文件 linmod.Rd和linmod-package.Rd,分别是对linmod()函数和linmod包的介绍,下面逐项填写:
1) linmod.Rd
\name{linmod}
\Rdversion{1.1}
\alias{linmod}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
linear regression
}
\description{
to give the more exactly results of linear regression
}
\usage{
linmod(x, y)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{x}{
a numeric design matrix for the model
}
\item{y}{
a numeric vector of responses
}
}
\details{
%%   ~~ If necessary, more details than the description above ~~
}
\value{
%%   ~Describe the value returned
%%   If it is a LIST, use
%%   \item{comp1 }{Description of 'comp1'}
%%   \item{comp2 }{Description of 'comp2'}
%% ...
}
\references{
Friedrich Leisch,2008 Creating R Packages: A Tutorial
}
\author{
helixcn
}
\note{
Please read Friedrich Leisch,2008 
}
%% ~Make other sections like Warning with \section{Warning }{....} ~
\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==>   Define data, use random,
##--   or do   help(data=index)   for the standard data sets.
## The function is currently defined as
function (x, y) 
{
qx <- qr(x)
coef <- solve.qr(qx, y)
df <- nrow(x) - ncol(x)
sigma2 <- sum((y - x \%*\% coef)^2)/df
vcov <- sigma2 * chol2inv(qx$qr)
colnames(vcov) <- rownames(vcov) <- colnames(x)
list(coefficients = coef, vcov = vcov, sigma = sqrt(sigma2), 
df = df)
}
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
2)linmod-package.Rd
\name{linmod-package}
\Rdversion{1.1}
\alias{linmod-package}
\alias{linmod}
\docType{package}
\title{Linear Regression Modification}
\description{to Give the more exactly output of linear regression rather than R default}
\details{
\tabular{ll}{
Package: \tab linmod\cr
Type: \tab Package\cr
Version: \tab 1.0\cr
Date: \tab 2009-07-20\cr
License: \tab GNU 2.0 or later\cr
LazyLoad: \tab yes\cr
}
~~The aim of the package was to give the more exactly output of linear regression~~ linmod~~
}
\author{helixcn
Maintainer: helixcn <[email protected]>}
\references{
Friedrich Leisch,2008,Creating R Packages: A Tutorial
}
\seealso{lm}
\examples{
data(cats, package="MASS")
mod1 <- linmod(Hwt~Bwt*Sex, data=cats)
mod1
summary(mod1)
}
四 通过cmd创建R包
开始>运行>cmd
键入 cd c:\pa\   将工作目录转移到c:/pa下
键入 Rcmd build --binary linmod   制作window zip包
键入 Rcmd build linmod   制作linux平台下可运行的tar.gz包
命令运行完之后可以发现,在c:/pa/文件夹下分别生成了linmod.zip和linmod.tar.gz压缩包。
注意R CMD 系列命令是在windows控制台下运行,而非R控制台
参考网址
[1]http://www.robjhyndman.com/researchtips/building-r-packages-for-windows/
[2]http://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf 
[3]http://faculty.chicagobooth.e/peter.rossi/research/bayes%20book/bayesm/Making%20R%20Packages%20Under%20Windows.pdf
[4]http://www.biostat.uni-hannover.de/teaching/fallstudien/schaarschmidt2.pdf
3. 按键精灵自动打怪脚本如何设置
[Script]
Plugin hwnd=Window.Foreground()
Import window.dll
VBSBegin 
    win=Window.Foreground()
    client=Window.GetClientRect(win)
    s=split(client,"|")
    dx=s(0)
    dy=s(1)
    zx=s(2)
    zy=s(3)
VBSEnd 
Dim red,blue,bbred,redwait,bluewait,monwait,fqg,jb,a,b,c,k,q,s1,s2,s3,s4,s5,s6,s7,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10
t1=now:t2=now:t3=now:t4=now:t5=now:t6=now:t7=now:a=0:b=0:c=0:q=0
UserVar fqg=DropList{防抢怪:0|不防抢怪:1}=0 防抢怪设置
UserVar jb=DropList{不捡包:0|自动捡包:1}=0 是否捡物
UserVar s1=2 门派普攻F1间隔(秒)
UserVar s2=20 单体攻击F2间隔(秒)
UserVar s3=20 单体攻击F3间隔(秒)
UserVar s4=25 怒气攻击F4间隔(秒)
UserVar s5=80 自定技能F5间隔(秒)
UserVar s6=60 BB技能F6间隔(秒)
UserVar s7=10 状态技能F7间隔(分)
UserVar red=DropList{30%:30|50%:50|70%:70}=1 血少于%加血F8
UserVar blue=DropList{30%:30|50%:50|70%:70}=0 蓝少于%加蓝F9
UserVar bbred=DropList{没有出战:0|20%:20|30%:30|50%:50}=2 宠少于%加血F10
UserVar redwait=1 红药冷却时间(秒)
UserVar bluewait=1 蓝药冷却时间(秒)
UserVar monwait=100 寻怪延时(毫秒)
PutAttachment .\plugin *.dll
Rem 开始
Delay monwait
Gosub 验证码
Gosub 找怪
If fqg=0
    IfColor dx+369,dy+31,1E252A,2
        Goto 开始
    EndIf 
EndIf 
Rem 继续杀怪
Gosub 判断血蓝状态
Gosub BB血状态
Gosub 杀怪
Rem End
EndScript 
Sub 验证码
    Rem 再次报警
    VBSCall FindPic(0,50,600,550,"Attachment:\yz1.bmp",0.9,x,y)
    If x>0 and y>0
        Plugin SimPlayer.ring(19)
        //使用了声音插件,需要自己去官网下载
        Delay 2000
    EndIf 
    While x>0
        VBSCall FindPic(0,300,600,550,"Attachment:\20S.bmp",0.9,x,y)
        If x>=0 and y>=0
            IfColor x+17,y+9-k,FFFFFF,0
                KeyPress 27 1
                Delay 1000
                MoveTo dx+446,dy+315
                Delay 1000
                LeftClick 1
                Goto End
            EndIf 
        Else 
            Goto 再次报警
        EndIf 
    EndWhile 
Return 验证码
Sub 判断血蓝状态
    IfColor red/100*120+66+dx,dy+31,222222,2
        a=a+1
    Else 
    EndIf 
    IfColor blue/100*120+66+dx dy+37 222222 2
        b=b+1
    Else 
    EndIf 
Return 判断血蓝状态
Sub BB血状态
    If bbred>0
        IfColor bbred+91+dx dy+69 111111 2
            c=c+1
        EndIf 
    EndIf 
Return BB血状态
Sub 找怪
    KeyDown 1,1
    Delay 10
    KeyPress 9,1
    Delay 10
    KeyUp 1,1
    Delay 10
Return 找怪
Sub 杀怪
    IfColor dx+247,dy+31,0019FF,2
        IfColor dx+261,dy+31,0011ff,2
            Gosub 技能
        Else 
            KeyPress 12 1
            Delay 1000
        EndIf 
        Goto 继续杀怪
    Else 
        If jb=1
            Gosub 捡包
        Else 
            Goto 开始
        EndIf 
    EndIf 
Return 杀怪
Sub 怒气判断
    IfColor qx+126,qy+43,00ffff,2
        q=1
    EndIf 
    IfColor qx+188,qy+43,00ffff,2
        q=2
    EndIf 
Return 怒气判断
Sub 技能
    Goto 开始
    If DateDiff("s",t1,now)>=s1
        KeyPress 12 1
        t1=now
        Delay 100
    EndIf 
    IfColor dx+261,dy+31,0011ff,2
        If DateDiff("s",t2,now)>=s2
            Delay 500
            KeyPress 113 1
            t2=now
            Delay 500
        EndIf 
    Else 
    EndIf 
    IfColor dx+261,dy+31,0011ff,2
        If DateDiff("s",t3,now)>=s3
            Delay 500
            KeyPress 114 1
            t3=now
            Delay 500
        EndIf 
    Else 
    EndIf 
    Gosub 怒气判断
    IfColor dx+261,dy+31,0011ff,2
        If DateDiff("s",t4,now)>=s4 and q>=1
            Delay 500
            KeyPress 115 1
            t4=now:q=q-1
            Delay 500
        EndIf 
    Else 
    EndIf 
    IfColor dx+261,dy+31,0011ff,2
        If DateDiff("s",t5,now)>=s5
            Delay 500
            KeyPress 116 1
            t5=now
            Delay 500
        EndIf 
    Else 
    EndIf 
    IfColor dx+261,dy+31,0011ff,2
        If DateDiff("s",t6,now)>=s6
            KeyPress 117 1
            t6=now
            Delay 100
        EndIf 
    EndIf 
    If DateDiff("n",t7,now)>=s7
        MoveTo dx+36,dy+35
        LeftClick 1
        Delay 100
        KeyPress 118 1
        t7=now
        Delay 100
        KeyDown 17,1
        Delay 10
        KeyPress 9,1
        Delay 10
        KeyUp 17,1
        Delay 10
    EndIf 
    If DateDiff("s",t8,now)>=redwait and a>=1
        KeyPress 119 1
        t8=now:a=0
        Delay 500
    EndIf 
    If DateDiff("s",t9,now)>=bluewait and b>=1
        KeyPress 120 1
        t9=now:b=0
        Delay 500
    EndIf 
    If DateDiff("s",t10,now)>=1 and c>=1
        KeyPress 121 1
        t10=now
        c=0
        Delay 500
    EndIf 
Return 技能
Sub 捡包
    Dim v,i,n,d,l,m,a1,b1,a2,b2,shape,x0,y0,k1,k2,x1,y1
    l=20:m=2:a1=dx+286:b1=dy+200:a2=dx+486:b2=dy+400:x0=dx+366:y0=dy+300:d=954439560
    If x0-a1>=a2-x0
        n=a1
    Else 
        n=x0-(a2-x0)
    EndIf 
    Rem 开始搜索
    v=l
    i=m
    x1=x0:y1=y0-v
    While x1>=n
        k1=0:k2=v
        For 2
            For i
                x1=x1+k1:y1=y1+k2
                If x1>=a1 and x1<=a2 and y1>=b1 and y1<=b2
                    MoveTo x1,y1
                    Delay 2
                    VBSCall shape=GetCursorShape(0)
                    If shape=d
                        Delay 50
                        RightClick 1
                        Delay 400
                        Goto 开始
                    EndIf 
                EndIf 
            EndFor 
            k1=v:k2=0
        EndFor 
        i=i+1:v=v*(-1)
    EndWhile 
    Goto 开始
Return 捡包
4. 按键精灵如何使用如何用按键精灵做脚本
打开“xx浏览器”软件,打开浏览器之后,下载“按键精灵”软件,下载好“按键精灵”之后,面对制作脚本为导向,下载好“按键精灵”之后,面对制作脚本为导向,需要进行以下步骤操作:立即体验-快速引导-第一次写脚本-鼠标左键连点然后提示着做完就好了。
