Yakman
2006-09-01 19:14:43
i might be adding some more if i make any
where to use:
where to use
i used this next procedure in Ice Magicks.scar, but i think some other people already discovered it, but ill post it anyway
where to use:
where to use
i got the idea for this when i was making a procedure in my script which burys bones
anyway, tell me what you think of this stuff
{*******************************************************************************
procedure SaveScreenshotArea(s:string;xs,ys,xe,ye:integer);
By: Yakman
Description: Saves a screenshot of an area specified by xs,yx,xe,ye.
*******************************************************************************}
procedure SaveScreenshotArea(s:string;xs,ys,xe,ye:integer);
var bmp:integer;path:string;
begin
if(copy(s,1,10)<>copy(apppath,1,10))and(copy(s,1,10)<>copy(scriptpath,1,10))then
path:=apppath+s//checks if the people have used apppath or scriptpath
else
path:=s
bmp:=bitmapfromstring(xe-xs,ye-ys,'')
safecopycanvas(getclientcanvas,getbitmapcanvas(bmp),xs,ys,xe,ye,0,0,xe-xs,ye-ys)
savebitmap(bmp,path)
freebitmap(bmp)
end;
if(findnormalrandoms)then
savescreenshotarea(scriptpath+'normal random '+timerunning+'.bmp',104,104,453,345{*******************************************************************************
procedure DisplayColor(color:integer;title:string);
By: Yakman
Description: Displays a color in the debug image window with a title.
*******************************************************************************}
procedure DisplayColor(color:integer;title:string);
var buffer,header,square:integer;
begin
header:=createbitmapmaskfromtext(title,upchars)
buffer:=bitmapfromstring(length(title)*8,50,'')
square:=bitmapfromstring(30,30,'')
fastdrawclear(buffer,0)
fastdrawclear(square,color)
fastdrawtransparent(length(title)*4-15,18,square,buffer)
fastdrawtransparent(2,2,header,buffer)
displaydebugimgwindow(length(title)*8,50)
safedrawbitmap(buffer,getdebugcanvas,0,0)
freebitmap(header)
freebitmap(buffer)
freebitmap(square)
end;where to use:
if(isuptext('Chop Down Yew')then
begin
treecol:=getcolor(x,y)
displaycolor(treecol,'Treecolor = '+inttostr(treecol))
{*******************************************************************************
procedure DisplayColorMulti(color1,color2,color3:integer,title:string);
By: Yakman
Description: Displays three colors in the debug image window with a title.
Note: if the title is too short the colors may overlap
*******************************************************************************}
procedure DisplayColorMulti(color1,color2,color3:integer;title:string);
var buffer,header,square:integer;
begin
header:=createbitmapmaskfromtext(title,upchars)
buffer:=bitmapfromstring(length(title)*10,50,'')
square:=bitmapfromstring(30,30,'')
fastdrawclear(buffer,0)
fastdrawclear(square,color1)
fastdrawtransparent(5,18,square,buffer)
fastdrawclear(square,color2)
fastdrawtransparent(length(title)*5-15,18,square,buffer)
fastdrawclear(square,color3)
fastdrawtransparent(length(title)*10-35,18,square,buffer)
fastdrawtransparent(2,2,header,buffer)
displaydebugimgwindow(length(title)*10,50)
safedrawbitmap(buffer,getdebugcanvas,0,0)
freebitmap(header)
freebitmap(buffer)
freebitmap(square)
end;this procedure was made because most colors seem to come in groups of threewhere to use
if(isuptextmulti('wn Y','Chop','Yew'))then
begin
treecol1:=getcolor(x,y)
treecol2:=getcolor(x+1,y+1)
treecol3:=getcolor(x-1,y-1)
displaycolormulti(treecol1,treecol2,treecol3,'Treecolors '+inttostr(treecol1)+' '+inttostr(treecol2)+' '+inttostr(treecol3))
i used this next procedure in Ice Magicks.scar, but i think some other people already discovered it, but ill post it anyway
{*******************************************************************************
procedure SetSelfWindowState(state:TWindowState);
By: Yakman
Description: Sets SCAR to a windows state.
States are wsNormal, wsMinimized, wsMaximized and possibly some others
*******************************************************************************}
procedure unsafesetwindow(state:twindowState);
var self:tform;
begin //dont use this procedure, use the safe one below
self:=getself
self.windowstate:=state
end;
procedure SetSelfWindowState(state:twindowstate);
var p:tvariantarray;
begin
setarraylength(p,1)
p[0]:=state
threadsafecall('unsafesetwindow', p)
end;where to use:
setupsrl
setupscript
setselfwindowstate(wsminimized)
{*******************************************************************************
function ProgPath:string;
By: Yakman
Description: Returns the file SCAR 2.03 is in, most likely C:\\program files\
*******************************************************************************}
function ProgPath:string;
var f:integer;
begin
result:=apppath
delete(result,length(result),1)
for f:=length(result) downto 0 do
begin
if(copy(result,f,1)='\')then break
else
delete(result,f,1)
end
end;where to use
if(findnormalrandoms)and(screenshots)then
savescreenshot(ProgPath+'Normal random '+timerunning+'.bmp')Im open to a different name for the function ProgPath{*******************************************************************************
procedure WindowsSound(Which:integer);
By: Yakman
Description: Plays the sound specified in Which.
Possible arguments are
0=Windows startup
1=Windows shutdown
2=Information bar beep
3=Chime
4=Chord
5=Win sound
6=Error sound
7=Logoff sound
8=Logon sound
*******************************************************************************}
procedure WindowsSound(Which:integer);
begin
case which of
0:playsound('C:\Windows\Media\windows xp startup.wav')
1:playsound('C:\Windows\Media\windows xp shutdown.wav')
2:playsound('C:\Windows\Media\windows xp information bar.wav')
3:playsound('C:\Windows\Media\chimes.wav')
4:playsound('C:\Windows\Media\chord.wav')
5:playsound('C:\Windows\Media\tada.wav')
6:playsound('C:\Windows\Media\windows xp error.wav')
7:playsound('C:\Windows\Media\windows xp logoff sound.wav')
8:playsound('C:\Windows\Media\windows xp logon sound.wav')
end
end;where to use
if(findnormalrandoms)then
begin
writeln('phew, random detected and the appropriate action taken')
windowssound(5)
Try this procedure to here them allvar f:integer;
begin
for f:=0 to 8 do
begin
windowssound(f)
writeln('Windows sound number '+inttostr(f))
wait(3000)
end
end.{*******************************************************************************
procedure EnterHouse(building:boolean);
By: Yakman
Description: Enters your house, building or normal mode
*******************************************************************************}
procedure EnterHouse(building:boolean);
var tempx,tempy,attempt:integer;found:boolean;
begin
repeat
found:=(findcolortolerance(tempx,tempy,4593205,msx1,msy1,msx2,msy2,10))
or(findcolortolerance(tempx,tempy,11749771,msx1,msy1,msx2,msy2,10))
attempt:=attempt+1
wait(50)
until(found)or(attempt>=20)
if(found)then
begin
mmouse(tempx,tempy,0,0)
wait(300+random(300))
if(isuptextmulti('Enter','er Po','Portal'))then
begin
wait(300+random(300))
getmousepos(tempx,tempy)
mouse(tempx,tempy,0,0,true)
flag
wait(300+random(300))
if(building)then
mouse(186,381,3,3,true)
else
mouse(200,364,3,3,true)
wait(3000+random(1000))
attempt:=0
while(not loggedin)do
begin
if(attempt>=200)then exit
wait(300+random(300))
attempt:=attempt+1
end
end
end
end;
if(players[currentplayer].loc:='falador')then
walktoportal
if(players[currentplayer].loc:='portal')then
enterhouse(false)
//stuff for training constuction
{*******************************************************************************
procedure EnterFriendsHouse(name:string);
By: Yakman
Description: Enters friend house of the name you specify
*******************************************************************************}
procedure EnterFriendsHouse(name:string);
var tempx,tempy,attempt:integer;found:boolean;
begin
repeat
found:=(findcolortolerance(tempx,tempy,4593205,msx1,msy1,msx2,msy2,10))
or(findcolortolerance(tempx,tempy,11749771,msx1,msy1,msx2,msy2,10))
attempt:=attempt+1
wait(50)
until(found)or(attempt>=20)
if(found)then
begin
mmouse(tempx,tempy,0,0)
wait(300+random(300))
if(isuptextmulti('Enter','er Po','Portal'))then
begin
wait(300+random(300))
getmousepos(tempx,tempy)
mouse(tempx,tempy,0,0,true)
flag
wait(300+random(300))
mouse(142,410,3,3,true)
wait(300+random(300))
typesend(name)
wait(3000+random(1000))
attempt:=0
while(not loggedin)do
begin
if(attempt>=200)then exit
wait(300+random(300))
attempt:=attempt+1
end
end
end
end;where to use
//cant think of anything, i just made it to go with EnterHouse(building:boolean);
these next ones were removed for a while because of the update, but i fixed them
{*******************************************************************************
function GetCombatLevel:integer;
By: Yakman
Description: Returns the combat level of the player
*******************************************************************************}
function GetCombatLevel:integer;
var lvl:string;
begin
if(not loggedin)then exit
gametab(1)
lvl:=trim(gettextatex(615,230,100,statchars,true,true,0,1,-1,40,true,tr_AlphaNumericChars))
if(copy(lvl,1,5)='ombat')then
delete(lvl,1,11)
lvl:=trim(lvl)
try
result:=strtoint(lvl)
except
writeln('Could Not Get Combat Level')
end
end;i got the idea for this when i was making a procedure in my script which burys bones
{*******************************************************************************
function ItemBoxCoords:TBox
By: Yakman
Description: Returns the coords of an inventory space, good for using with
inventory Bitmaps or DTMs
*******************************************************************************}
function ItemBoxCoords(InvSpot:integer):TBox;
var itemcrd:tpoint;
begin
itemcrd:=itemcoords(invspot)
result.x1:=itemcrd.x-11
result.y1:=itemcrd.y-8
result.x2:=itemcrd.x+14
result.y2:=itemcrd.y+18
end;where to use:
for f:=1 to 28 do
begin
itemb:=itemboxcoords(f)
if(findDTM(bones,x,y,itemb.x1,itemb.y1,itemb.x2,itemb.y2))then
begin
mmouse(x,y,5,5)
wait(500+random(300))
if(isuptext('ury'))then
begin
getmousepos(x,y)
mouse(x,y,0,0,true)
anyway, tell me what you think of this stuff