lardmaster
2006-10-26 20:20:12
after many an hours of work, here is my song singer, V2.1, it should work…
// Lardmaster's songsinger V2.1 //
// //
// Features: Sings songs from file, autoresponder with user //
// tracking,multiple song singing. //
// //
// Future: Expanded autoresponder, responding with song //
// titles and artist names, introductions to songs. //
// //
// Setup: define filepath as the string of the location of //
// the file with the songs in it. target runescape and //
// press play. there will be a 20 second delay before it //
// starts typing. put "~~~" in between each song, and name: //
// blahblah; and artist:blahblah; in the song file. nickname //
// is substring of name. //
// //
// more coming soon! //
{.include srl/srl.scar}
{.include srl/srl/extended/xtext.scar}
var S,filepath,nickname: string;
Filenum,songspot,i,playernum,responded: Integer;
songarray,playerstalked,normalr,buggedr,boredr:array of string;
playerstimes,numanswered:array of integer;
procedure definefilepath;
begin
filepath:='D:/Program Files/Scar 2.03/Songs.txt'; //<--change this!!
nickname:='lard'//<--- this too!
end;
function GetSongName : string;
var i,j : Integer;
Temp2:string;
doublebreak:boolean;
begin for i:=1 to length(s) do begin
Temp2 := Copy ( s, i, 6 );
if doublebreak then break;
if (Temp2 = 'name: ') then begin
Temp2:='';
j:=i+6;
while (j<i+26) do begin
Result := Result + s[j];
if (GetKeyCode(s[j+1]) = 186)then doublebreak:=true;
if doublebreak then break;
j:=j+1;
end end end;
end;
function GetSongArtist : string;
var p,j : Integer;
Temp2:string;
doublebreak:boolean;
begin
for p:=1 to length(s) do begin
Temp2 := Copy ( s, p, 8 );
if doublebreak then break;
if (Temp2 = 'artist: ')then begin
Temp2:='';
j:=p+8;
while (j<p+26) do begin
Result := Result + s[j];
if (GetKeyCode(s[j+1]) = 186)then doublebreak:=True;
j:=j+1;
if doublebreak then break;
end;
end
end;
end;
function getnextsong(var x:integer):string;
var i:integer;
temp:string;
begin
for i:=x to length(s) do begin
temp:=copy(s,i,3)
if temp = '~~~' then begin
Result:=copy(s, x, i-x);
x:=i+3;
break;
end
end
end;
function numsongs(s:string):integer;
var i:integer;
begin
for i:=1 to (length(s)) do begin
if(copy(s,i,3)='~~~') then Result:= Result+1;
end
end;
function findchatname(s:string):string;
begin
i:=1;
while (not s[i+1]=':') and (i<length(s)-1) do i:=i+1;
Result:=copy(s,1,i);
end;
function isrepeat(name:string):boolean;
var tempname:string;
begin
for i:=1 to playernum do if(tempname=playerstalked[playernum]) then result:=true;
end;
function getplayernum(name:string):integer;
var tempname:string;
begin
i:=1;
while not(tempname=playerstalked[i])do i:=i+1;
result:=i;
end;
procedure typeresponse(numa:integer);
begin
case numa of
1:sendmytext(normalr[random(21)])
2 or 3:sendmytext(boredr[random(23)]);
4:sendmytext(buggedr[random(24)]);
end
end;
function findsongrandoms:boolean;
var tempname,lastchat:string;
begin
if inchatmulti(nickname,'song','sing') then begin
lastchat:=getnewchatmsg;
tempname:=findchatname(lastchat);
if not isrepeat(tempname) then begin
writeln('we found a new person talking about us!');
playerstalked[playernum]:=tempname;
numanswered[playernum]:=1;
markTime(playerstimes[playernum]);
typeresponse(1);
playernum:=playernum+1;
Result:=true;
end else begin
writeln('someone is bugging us again!');
Result:=true;
playernum:=getplayernum(tempname);
if (numanswered[playernum]<5)and (timefrommark(playerstimes[playernum])>10000) then typeresponse(numanswered[playernum]);
marktime(playerstimes[playernum]);
numanswered[playernum]:=numanswered[playernum]+1;
end
end
end;
procedure setupmychats;
begin
playernum:=0;
setarraylength(normalr,21);
setarraylength(buggedr,23);
setarraylength(boredr,24);
normalr[0]:='im singing,lol';
normalr[1]:='its the song that never ends!';
normalr[2]:='you dont know the song?';
normalr[3]:='lol';
normalr[4]:='lol';
normalr[5]:='lol';
normalr[6]:='lol';
normalr[7]:='you probably dont know the song im singin';
normalr[8]:='im havin fun';
normalr[9]:='just singin';
normalr[10]:='i sing songs';
normalr[11]:='its fun';
normalr[12]:='duh';
normalr[13]:='u dont know that?';
normalr[14]:='cool...';
normalr[15]:='...';
normalr[16]:='no comment :)';
normalr[17]:='i be cool';
normalr[18]:='may the dung be with you too.';
normalr[19]:='aduh? are you sped too?';
normalr[20]:='yeah... i agree with that too... lol :)...i am high';
buggedr[0]:='begone';
buggedr[1]:='leave';
buggedr[2]:='get lost';
buggedr[3]:='stop talkin to me';
buggedr[4]:='"expelliarimous" *i zap you*';
buggedr[5]:='get a life';
buggedr[6]:='uhh... let me sing my song in peace';
buggedr[7]:='im just singin, so stop';
buggedr[8]:='no comment';
buggedr[9]:='make like some cream and get whipped';
buggedr[10]:='*sigh*, i wish i was the only one on this world';
buggedr[11]:='avast, ye scalliwag, im singin';
buggedr[12]:='stop bugging me!';
buggedr[13]:='aaaaauuuuuggggghhhh!';
buggedr[14]:='die';
buggedr[15]:='dont make me kill you in a duel!';
buggedr[16]:='yes, you should shut up';
buggedr[17]:='i no talky no more';
buggedr[18]:='no speaky bugger';
buggedr[19]:='why u pester me?';
buggedr[20]:='get a muzzle and stop talking';
buggedr[21]:='go away';
buggedr[22]:='whatever';
buggedr[22]:='your quitting rs?...goood!';
boredr[0]:='wave:8*************************';
boredr[1]:='why i give life to rs?';
boredr[2]:='yes...i am bored!!!';
boredr[3]:='gasgdlk;nwae';
boredr[4]:='and life goes on...';
boredr[5]:='333 is the number of the beast :P';
boredr[6]:='i sing for boredness';
boredr[7]:='i just sing cause nothing else to do';
boredr[8]:='wowowowowowoow';
boredr[9]:='me no care bout that, no offence';
boredr[10]:='lets go bucaneers (srry for ignoring you...)';
boredr[11]:='lalalallala, is that singing better?';
boredr[12]:='cgvsd;lkfmgsd... that is my thoughts on what u say';
boredr[13]:='*ignores you*';
boredr[14]:='i think i will sing my song irregardless';
boredr[15]:='idk,the person next to me is with stupid :P';
boredr[16]:='...';
boredr[17]:='cool, im 1337 too...';
boredr[18]:='gaaaaaaaaaah';
boredr[19]:='you know, i should be doing hw instead of singing this';
boredr[20]:='hmmm... ill consider that very hardly';
boredr[21]:='lol';
boredr[22]:='lol';
boredr[23]:='lol';
end;
procedure singsong(song:string);
var Temp, ToSend : string;
i:integer;
begin
i:=1;
while i<length(song) do begin
while not (getkeycode(song[i]) = 13) and (i < Length(song)) do begin
Temp := copy( song, i, 1);
ToSend:= ToSend + Temp;
i := i + 1;
end;
i := i + 2;
if(findsongrandoms) then responded:=responded+1;
Sendmytext ( ToSend );
keydown(13);
keyup(13);
Tosend:='';
end;
end;
begin
setupsrl;
setupmychats;
definefilepath;
Filenum := Openfile (filepath,True);
ReadFileString ( Filenum, s, FileSize ( Filenum ));
songspot:=1;
writeln(inttostr(numsongs(s)));
WriteLn (GetSongName+'is the song');
WriteLn (GetSongartist+'is actually artist');
playernum:=1;
setarraylength(songarray,numsongs(s));
activateclient;
for i:=0 to numsongs(s)-1 do songarray[i]:=getnextsong(songspot);
for i:=0 to numsongs(s)-1 do begin
singsong(songarray[i]);
sleep(2000);
end
writeln(inttostr(responded));
end.