SRL Archive - OSR Help

shut down pc


sidishere

2007-10-17 01:59:51

hey, i just need some help added a procedure into a script. i got this shutdown procedure from Tails111's (Heavily Edited by Hy) script. which can be found at:
http://www.villavu.com/forum/showthread.php?t=17735
so i take no credit whatsoever for it.
procedure ShutDownPC;
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;

i want to add it into someelse's script so that it will shutdown the pc when the player = false (not working anymore). this is what i got so far:
procedure ShutDownPC;
begin
if Players[0].Active := False; Then

KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;
but it comes up with this:
Line 59: [Error] (15409:22): 'THEN' expected in script
could someone please help? thanks = ]

Rikje

2007-10-17 02:06:56


procedure ShutDownPC;
begin
if Players[0].Active := False Then //no ; before a then!

KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;
don't put there a ; ;)

sidishere

2007-10-17 02:28:31

it still says this even after i remove it:
Failed when compiling
Line 59: [Error] (15409:28): 'THEN' expected in script
would it help if i told you it is "the claw"s lumbridge swamp miner im trying to edit?

MasterKill

2007-10-17 03:27:32

i think this will work

procedure ShutDownPC;
begin
if (Players[0].Active := False) Then
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;
end;

Lacky

2007-10-17 04:41:46

Nice script, but what if someone (such as me :p) has another program starting with "R" in their start thing?

Pancakes

2007-10-17 06:06:23

I think it defaults to run..

shaunthasheep

2007-10-17 09:51:08

From: MasterKill
i think this will work

procedure ShutDownPC;
begin
if (Players[0].Active := False) Then
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;
end;


procedure ShutDownPC;
begin
if not (Players[0].Active) Then
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;
end;

:p

(The real error is that you had := False, it should of been = False with no assigment, begins and ends are also needed)

drumstel7

2007-10-17 09:54:14

i have somtimes the same problem but i have a line 54 error or something

MasterKill

2007-10-17 10:47:42

From: The_Rs_Monkey
procedure ShutDownPC;
begin
if not (Players[0].Active) Then
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;
end;

:p

(The real error is that you had := False, it should of been = False with no assigment, begins and ends are also needed)


O LOL YES,

I was a lil to fast, looked at the begin end; thing

sidishere

2007-10-17 17:53:23

thanks rs monkey as masterkill :D
i complied but i thought to actually test the shutdown pc thing i would play it seperatley in scar
so i put this in a blank window:
procedure ShutDownPC;

begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;

when i ran it it said:
Failed when compiling
[Error] (15:1): Unexpected end of file

shouldnt it shut down my pc?

nething

2007-10-17 18:02:20


Program New;

procedure ShutDownPC;
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;

begin
ShutDownPC;
end.

Try that? (main loop + Program and procedure)

Or maybe the end just needs period instead of semi colon.

sidishere

2007-10-17 18:40:26

that worked by its self and shut down the pc, thanks
but when i put it into the script like this:
procedure ShutDownPC;

begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));

end;
begin
if not (Players[0].Active) Then
ShutDownPC;
end.

it says [Runtime Error] : Out Of Range in line 72 in script
line 72 is this: if not (Players[0].Active) Then
whats the problem now lol?

Derek-

2007-10-17 18:54:21

Make sure to declare your players properly.

Procedure DeclarePlayers;
begin
NumberOfPlayers(4); //make sure to include this part.
//the number should be how ever many players you include in the script
//in this case it'd be 4
CurrentPlayer := 0;

Players[0].Name :=''; //Username
Players[0].Pass :=''; //Password
Players[0].Nick :=''; //3-4 letters of nickname
Players[0].Active := True; //Do you want to use this player?

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Active := False;

Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Active := False;

Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Active := False;
end;

sidishere

2007-10-17 19:07:38

i did, well the claw did :
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
Players[0].Loc := 'Mine';
Players[0].Integers[0] := 15; // Secs to wait
Players[0].Booleans[0] := False; //EquipPick;
Players[0].Strings[0] := 'Mith'; //Highest ore to mine? Coal, Mith or Addy
Players[0].Strings[1] := '0000'; //bank pin?

eFox

2007-10-18 18:30:56

From: sidishere
that worked by its self and shut down the pc, thanks
but when i put it into the script like this:
procedure ShutDownPC;

begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));

end;
begin
if not (Players[0].Active) Then
ShutDownPC;
end.

it says [Runtime Error] : Out Of Range in line 72 in script
line 72 is this: if not (Players[0].Active) Then
whats the problem now lol?


Why are you putting that in? Use what was suggested before to run it withing a script.


procedure ShutDownPC;
begin
if(Players[0].Active = False) Then
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13));
end;
end;

then you would need to call 'ShutDownPc;' somewhere in your script.

i dont get how it works though because i thought i was windows key then /r

Tails111

2007-10-19 19:39:40

I actually got the shutdown procedure from a diferent script, don't remember where. Anyways, It won't work in most scripts and in my script because the procedure NextPlayer; has an infinate loop, so it never gets a chance to call it. If anyone could help me, or think of how to fix the infinate loop please tell.

boommaster

2007-10-29 16:29:32

nice:D

Lacky

2007-10-30 07:13:44

From: Pancakes
I think it defaults to run..


No, it doesn't.

Metagen

2007-10-30 08:35:37

A: Boommaster making posts like that will get u banned.

B: Instead of clicking on startmenu and then the run thing (thats what i gather your script does) just make it hit the keys window + r

EDIT: wait nvm im an idiot :p

Lacky

2007-10-31 04:42:00

Yes, the windows key + r works, but you have to hold the windows key down.

sidishere

2007-11-02 00:47:20

well i was trying to add it into masterkill's fali guild miner so that when the first player is false it shuts down the comp(i only have one char with 60 mining)
and summilions rimmington miner. any help guys?

Metagen

2007-11-02 08:12:46


if Players[0].Active = False then ShutDownPc;

Lacky

2007-11-02 23:34:50

ShutDownPC; is a function now?

sidishere

2007-11-03 02:43:12

no its a procedure