SRL Archive - OSR Help

simba wont recognize the string


punkd

2012-04-07 16:43:28

kk, so I have a string setup to tell the script what procedures to run. It runs fairly well (not flawless) but when it does fail it decides to skip the mainloop to the next one

whatarewedoing := 'Leather';

^^ Declareplayers string

if whatarewedoing = 'Leather' then
begin
mainloopleather;
end;
if whatarewedoing = 'Jewelry' then
begin
mainloopjewelry;
end;
if whatarewedoing = 'Cannonball' then
begin
mainloopsmithing;
end;

For some reason, if it fails making leather at any moment (due to lag or failure to find dtm) it skips over to the Jewelry mainloop.

any advice?

Awkwardsaw

2012-04-07 16:46:44

Can you post more? Lag has nothing to do with what you posted. Also use a case:


case lowercase(whatarewedoing) of
'leather' : mainloopleather;
'jewelry' : mainloopjewelry;
'cannonball' : mainloopsmithing;
end;

Frement

2012-04-07 16:48:55

// WORKS PERFECTLY
program new;

const whatarewedoing = 'Leather';

begin
if whatarewedoing = 'Leather' then
begin
writeln('Doing: '+ whatarewedoing);
end;
if whatarewedoing = 'Jewelry' then
begin
writeln('Doing: '+ whatarewedoing);
end;
if whatarewedoing = 'Cannonball' then
begin
writeln('Doing: '+ whatarewedoing);
end;
end.

// BUT I WOULD USE THIS
program new;

const whatarewedoing = 'Leather';

begin
case whatarewedoing of
'Leather': begin
writeln('Doing: '+ whatarewedoing);
end;
'Jewelry': begin
writeln('Doing: '+ whatarewedoing);
end;
'Cannonball': begin
writeln('Doing: '+ whatarewedoing);
end;
end;
end.

punkd

2012-04-07 17:29:02

From: Awkwardsaw
Can you post more? Lag has nothing to do with what you posted. Also use a case:


case lowercase(whatarewedoing) of
'leather' : mainloopleather;
'jewelry' : mainloopjewelry;
'cannonball' : mainloopsmithing;
end;


I'm saying a lag in one of the procedures within the loops. If it fails a procedure it forgets its making leather and does jewelry instead. Yeah I know I havn't added lowercase yet, I have like 100 different items to add so thatll be in the end


From: Frement
// WORKS PERFECTLY
program new;

const whatarewedoing = 'Leather';

begin
if whatarewedoing = 'Leather' then
begin
writeln('Doing: '+ whatarewedoing);
end;
if whatarewedoing = 'Jewelry' then
begin
writeln('Doing: '+ whatarewedoing);
end;
if whatarewedoing = 'Cannonball' then
begin
writeln('Doing: '+ whatarewedoing);
end;
end.

// BUT I WOULD USE THIS
program new;

const whatarewedoing = 'Leather';

begin
case whatarewedoing of
'Leather': begin
writeln('Doing: '+ whatarewedoing);
end;
'Jewelry': begin
writeln('Doing: '+ whatarewedoing);
end;
'Cannonball': begin
writeln('Doing: '+ whatarewedoing);
end;
end;
end.


I'll give it a go, but somethings not right here 0.o

Sin

2012-04-07 17:32:40

You're forgetting to repeat it…?

punkd

2012-04-07 19:05:45

Thanks guys, I guess it was the banking that was messing it up. It wouldn't detect that I was Crafting leather. It works great now. Thanks anyway guys!

Kyle Undefined

2012-04-07 21:44:53

Also, add a LowerCase() around the string, since people might not type the string correctly.

Sex

2012-04-07 21:57:47

From: Kyle Undefined
Also, add a LowerCase() around the string, since people might not type the string correctly.


Also, try reading the thread before you post <3.
From: punkd
I'm saying a lag in one of the procedures within the loops. If it fails a procedure it forgets its making leather and does jewelry instead. Yeah I know I havn't added lowercase yet, I have like 100 different items to add so thatll be in the end

punkd

2012-04-08 17:04:28

From: Sex
Also, try reading the thread before you post <3.


Give him a break! He's a busy guy! =P

Kyle Undefined

2012-04-08 18:45:28

Haha what he said ^ :p