SRL Archive - OSR Help

help with inventory function


flappy

2014-08-27 09:50:43

I'm trying to get InvEmpty to work. I can get DropItem to work. Help is very much appreciated. I //'d out what I wanted it to type initially to try CloseBank like in the example used in the function's description. Here is my code:

program inven;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/misc/al_functions.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
{$I SRL-OSR/SRL/misc/SmartGraphics.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='no';
Players[0].Pass :='no';
Players[0].Nick :='no';
Players[0].Active:=True;
end;

[B]procedure typeStuff;
begin
if InvEmpty then
CloseBank;
//TypeSendEx('I have no items', true);
end;[/B]

begin
SetupSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
SMART_ClearCanvas;
LoginPlayer;

typeStuff;

end.

Lipcot

2014-08-27 09:53:34

you should indent and:
Put it like this with the "code" button so people understand it easier

rj

2014-08-27 10:31:19

what is not working about it?

flappy

2014-08-29 01:46:34

From: Robert
what is not working about it?


It does not close the bank when inventory is empty, nor does it type anything when I take out the //. I have tried it with if/else statement and it only does the 'else' despite the inventory being empty.

rj

2014-08-29 10:22:41

From: flappy
It does not close the bank when inventory is empty, nor does it type anything when I take out the //. I have tried it with if/else statement and it only does the 'else' despite the inventory being empty.


try writeln(InvEmpty) and see if it returns true while the bank is open

Unfold

2014-08-29 10:40:57

Just try If Not(InvFull)

that works better imo

flappy

2014-08-30 05:31:49

From: Robert
try writeln(InvEmpty) and see if it returns true while the bank is open


Still returns false, whether bank is open or not.

From: Unfold
Just try If Not(InvFull)

that works better imo


Yeah that works, thanks.

rj

2014-08-30 09:36:39

Seems like the InvEmpty function is broken :s

Dezval

2014-09-05 02:21:10

try InvCount=0 or InvCount<1 in place of InvEmpty. It's the same thing.
Like so:

program inven;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/misc/al_functions.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
{$I SRL-OSR/SRL/misc/SmartGraphics.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='no';
Players[0].Pass :='no';
Players[0].Nick :='no';
Players[0].Active:=True;
end;

procedure typeStuff;
begin
if InvCount=0 then
CloseBank;
//TypeSendEx('I have no items', true);
end;

begin
SetupSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
SMART_ClearCanvas;
LoginPlayer;

typeStuff;

end.

And although you have it commented out, maybe you should either remove the TypeSendEx or replace it with Writeln, because you don't want rs players to notice you keep saying the same thing every time the bank closes.