SRL Archive - Test corner

Test: emotions procedure


warship45

2006-09-27 13:29:03

hi, i have just finshed the new emotions procedure i have posted it here for you all to test as far as i can tell it works but i have not tested every emotion yet.

thanks warship45

p.s. this is most lilky not the best way to code it but it seemed the best way at the time of making it!

Var
Emotions: array[1..36] of String;
EmotBarcolor,xxx1,yyy1: Integer;

Procedure LoadEmotions;
begin
EmotBarcolor:= 3359309;
Emotions[1]:='Yes';
Emotions[2]:='No';
Emotions[3]:='Bow';
Emotions[4]:='Angry';
Emotions[5]:='Think';
Emotions[6]:='Wave';
Emotions[7]:='Shrug';
Emotions[8]:='Cheer';
Emotions[9]:='Beckon';
Emotions[10]:='Laugh';
Emotions[11]:='Jump';
Emotions[12]:='Yawn';
Emotions[13]:='Dance';
Emotions[14]:='Jig';
Emotions[15]:='Spin';
Emotions[16]:='Headbang';
Emotions[17]:='Cry';
Emotions[18]:='Kiss';
Emotions[19]:='Panic';
Emotions[20]:='Raspbery';
Emotions[21]:='Clap';
Emotions[22]:='Salute';
Emotions[23]:='Gblow';
Emotions[24]:='Gdance';
Emotions[25]:='Glassbox';
Emotions[26]:='Climbrope';
Emotions[27]:='Lean';
Emotions[28]:='Glasswall';
Emotions[29]:='Idea';
Emotions[30]:='Stamp';
Emotions[31]:='Flap';
Emotions[32]:='Slaphead';
Emotions[33]:='Zwalk';
Emotions[34]:='Zdance';
Emotions[35]:='Scared';
Emotions[36]:='Rhop';
end;

//Find emotion
Function FindEmotion(Var Tempx,Tempy: Integer;EmotionName: string):Boolean;
var
Emotcheck: Integer;
EmotionsNumber: Integer;
rnd,rnd1,
Checker: Integer;
simplestring: string;
begin
if Emotions[1]='' then begin loademotions; end;
for Emotcheck:= 1 to 36 do
begin
if Lowercase(Emotions[Emotcheck])=Lowercase(EmotionName) then
begin
EmotionsNumber:=Emotcheck;
end;
end;
if EmotionsNumber<1 then
begin
result:=False;
exit;
end;
//Getting x and y of Emotion
result:=True;
GameTab(12);
rnd:=random(5);
rnd1:=random(24);
if EmotionsNumber>20 then
begin
if Getcolor(729,431)<>Emotbarcolor then
begin
Mouse(729+random(10),431+random(10),1,1,True);
end;
simplestring:= FloatToStr(EmotionsNumber/4);
checker:=1;
while StrGet(simplestring,checker)<>'.' do
begin
checker:=checker+1;
end;
simplestring:= StrGet(simplestring, checker+1);
simplestring:= inttostr(10-StrToint(simplestring)-1);
simplestring:= '0.'+simplestring;
Tempy:=216+rnd1+(round(EmotionsNumber/4+(strtofloat(simplestring))-5))*50;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=5 then
begin
EmotionsNumber:=EmotionsNumber-20;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=6 then
begin
EmotionsNumber:=EmotionsNumber-24;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=7 then
begin
EmotionsNumber:=EmotionsNumber-28;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=8 then
begin
EmotionsNumber:=EmotionsNumber-32;
end;
rnd:=542+rnd*EmotionsNumber+(40*EmotionsNumber-rnd);
Tempx:=rnd;
end else begin
if Getcolor(730,224)<>Emotbarcolor then
begin
Mouse(730+random(9),224+random(8),1,1,True);
end;
simplestring:= FloatToStr(EmotionsNumber/4);
checker:=1;
while StrGet(simplestring,checker)<>'.' do
begin
checker:=checker+1;
end;
simplestring:= StrGet(simplestring, checker+1);
simplestring:= inttostr(10-StrToint(simplestring)-1);
simplestring:= '0.'+simplestring;
Tempy:=216+rnd1+(round(EmotionsNumber/4+(strtofloat(simplestring))-1))*50;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=1 then
begin
EmotionsNumber:=EmotionsNumber-4;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=2 then
begin
EmotionsNumber:=EmotionsNumber-8;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=3 then
begin
EmotionsNumber:=EmotionsNumber-12;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=4 then
begin
EmotionsNumber:=EmotionsNumber-16;
end;
rnd:=542+rnd*EmotionsNumber+(40*EmotionsNumber-rnd);
Tempx:=rnd;
end;
end;

//Checks if you can play that Emotion
Function CheckEmotion(EmotionName: string):Boolean;
var
Emotcheck: Integer;
EmotionsNumber: Integer;
rnd,rnd1,Tempx,Tempy: Integer;
Checker: Integer;
simplestring: string;
begin
if Emotions[1]='' then begin loademotions; end;
for Emotcheck:= 1 to 36 do
begin
if Lowercase(Emotions[Emotcheck])=Lowercase(EmotionName) then
begin
EmotionsNumber:=Emotcheck;
end;
end;
if EmotionsNumber<1 then
begin
result:=False;
exit;
end;
//Getting x and y of Emotion
GameTab(12);
rnd:=random(5);
rnd1:=random(24);
if EmotionsNumber>20 then
begin
if Getcolor(729,431)<>Emotbarcolor then
begin
Mouse(729+random(10),431+random(10),1,1,True);
end;
simplestring:= FloatToStr(EmotionsNumber/4);
checker:=1;
while StrGet(simplestring,checker)<>'.' do
begin
checker:=checker+1;
end;
simplestring:= StrGet(simplestring, checker+1);
simplestring:= inttostr(10-StrToint(simplestring)-1);
simplestring:= '0.'+simplestring;
Tempy:=216+rnd1+(round(EmotionsNumber/4+(strtofloat(simplestring))-5))*50;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=5 then
begin
EmotionsNumber:=EmotionsNumber-20;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=6 then
begin
EmotionsNumber:=EmotionsNumber-24;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=7 then
begin
EmotionsNumber:=EmotionsNumber-28;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=8 then
begin
EmotionsNumber:=EmotionsNumber-32;
end;
rnd:=542+rnd*EmotionsNumber+(40*EmotionsNumber-rnd);
Tempx:=rnd;
Mouse(Tempx,Tempy,1,1,True);
end else begin
if Getcolor(730,224)<>Emotbarcolor then
begin
Mouse(730+random(9),224+random(8),1,1,True);
end;
simplestring:= FloatToStr(EmotionsNumber/4);
checker:=1;
while StrGet(simplestring,checker)<>'.' do
begin
checker:=checker+1;
end;
simplestring:= StrGet(simplestring, checker+1);
simplestring:= inttostr(10-StrToint(simplestring)-1);
simplestring:= '0.'+simplestring;
Tempy:=216+rnd1+(round(EmotionsNumber/4+(strtofloat(simplestring))-1))*50;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=1 then
begin
EmotionsNumber:=EmotionsNumber-4;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=2 then
begin
EmotionsNumber:=EmotionsNumber-8;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=3 then
begin
EmotionsNumber:=EmotionsNumber-12;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=4 then
begin
EmotionsNumber:=EmotionsNumber-16;
end;
rnd:=542+rnd*EmotionsNumber+(40*EmotionsNumber-rnd);
Tempx:=rnd;
Mouse(Tempx,Tempy,1,1,True);
end;
if ((GetColor(Tempx,Tempy)=2700347) or (GetColor(Tempx,Tempy)=2636866)) then
begin
result:=False;
end else begin
result:=True;
end;
end;

//Clicks on an emotion
Function PlayEmotion(EmotionName: string):Boolean;
var
Emotcheck: Integer;
EmotionsNumber: Integer;
rnd,rnd1: Integer;
Checker: Integer;
Tempx,Tempy: Integer;
simplestring: string;
begin
if Emotions[1]='' then begin loademotions; end;
for Emotcheck:= 1 to 36 do
begin
if Lowercase(Emotions[Emotcheck])=Lowercase(EmotionName) then
begin
EmotionsNumber:=Emotcheck;
end;
end;
if CheckEmotion(Emotions[EmotionsNumber])=False then
begin
EmotionsNumber:=0;
end;
if EmotionsNumber<1 then
begin
result:=False;
exit;
end;
//Getting x and y of Emotion
result:=True;
GameTab(12);
rnd:=random(5);
rnd1:=random(24);
if EmotionsNumber>20 then
begin
if Getcolor(729,431)<>Emotbarcolor then
begin
Mouse(729+random(10),431+random(10),1,1,True);
end;
simplestring:= FloatToStr(EmotionsNumber/4);
checker:=1;
while StrGet(simplestring,checker)<>'.' do
begin
checker:=checker+1;
end;
simplestring:= StrGet(simplestring, checker+1);
simplestring:= inttostr(10-StrToint(simplestring)-1);
simplestring:= '0.'+simplestring;
Tempy:=216+rnd1+(round(EmotionsNumber/4+(strtofloat(simplestring))-5))*50;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=5 then
begin
EmotionsNumber:=EmotionsNumber-20;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=6 then
begin
EmotionsNumber:=EmotionsNumber-24;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=7 then
begin
EmotionsNumber:=EmotionsNumber-28;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=8 then
begin
EmotionsNumber:=EmotionsNumber-32;
end;
rnd:=542+rnd*EmotionsNumber+(40*EmotionsNumber-rnd);
Tempx:=rnd;
Mouse(Tempx,Tempy,1,1,True);
end else begin
if Getcolor(730,224)<>Emotbarcolor then
begin
Mouse(730+random(9),224+random(8),1,1,True);
end;
simplestring:= FloatToStr(EmotionsNumber/4);
checker:=1;
while StrGet(simplestring,checker)<>'.' do
begin
checker:=checker+1;
end;
simplestring:= StrGet(simplestring, checker+1);
simplestring:= inttostr(10-StrToint(simplestring)-1);
simplestring:= '0.'+simplestring;
Tempy:=216+rnd1+(round(EmotionsNumber/4+(strtofloat(simplestring))-1))*50;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=1 then
begin
EmotionsNumber:=EmotionsNumber-4;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=2 then
begin
EmotionsNumber:=EmotionsNumber-8;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=3 then
begin
EmotionsNumber:=EmotionsNumber-12;
end;
if round(EmotionsNumber/4+(strtofloat(simplestring))-1)=4 then
begin
EmotionsNumber:=EmotionsNumber-16;
end;
rnd:=542+rnd*EmotionsNumber+(40*EmotionsNumber-rnd);
Tempx:=rnd;
Mouse(Tempx,Tempy,1,1,True);
end;
end;


Just updated them agin they should all be working thnaks for your support

Yakman

2006-09-27 14:17:08

i just tested it with a for loop, it works very well, the only problem is that it scrolls down even when the bar is on the bottom already, this could be fixed with a getcolor,
also it clicked emotes even though they were not unlocked, but this isnt a big issue, the scripter just wont use these emotes

warship45

2006-09-27 14:34:48

thanks for you comments i am going to go and mod the script to have mayby have more than one procedure and function so that you can have more commarands to do diffrent things e.g. findemotipon and so on and play emmotion i will make these and post an update.

thanks for testing.

Yakman

2006-09-27 16:04:02

i tested everything and it all works, it was intresting with findemote, i put mmouse after it and it was quite intresting watching it move in that pattern

warship45

2006-09-27 16:50:34

Thanks for testing and i am happy to here that everything worked.

thanks warship

warship45

2006-09-29 09:25:03

Just added a new update to the functions they have been testing and are now all working.