So i asked how i would find out which ore the user chose to mine, but i'm just curious if i could do a if (players[0].strings :='tin, copper, iron, etc') then
findobj?
So i asked how i would find out which ore the user chose to mine, but i'm just curious if i could do a if (players[0].strings :='tin, copper, iron, etc') then
findobj?
It would be easier to use a case, and use the string the user inputs are the cases.
then you can use FindObj after you declare the colors or whatever you're going to use in the case
example:
SCAR Code:var
Color: Array of Integer;
begin
case Lowercase(players[0].strings[1]) of
'tin': Color: ...
'copper': Color: ...
'iron': Color: ...
end else
if FindObj(x, y, uptext, Color, 5) then
Last edited by Runaway; 08-25-2009 at 12:03 AM.
To add to what Runaway said,
You would want to do CurrentPlayer, not 0 for the number, since it is a multi player script:
SCAR Code:var
Color: Integer;
case LowerCase(Players[CurrentPlayer].Strings[1])of
'tin': Color := 239586;
'iron': Color := 964053;
//...etc.
end;
if(FindObj(x,y,'Mine',Color,5))then
And the array shouldn't be necessary unless you have multiple colors for each different rock.
and to help you with your if/thens, you would've got an error you did:
if (players[0].strings :='tin, copper, iron, etc') then
notice the ":=" you don't use := in if/thens, because you'll get an error, it'll think you are trying to set a value, which you don't do in if/thens. It would be:
if (players[0].strings='tin, copper, iron, etc') then
but yea, a case would work better, and remember to do lowercase or uppercase, in:
case lowercase(... or
case uppercase(...
and then remember to have the case ofs to be either upper or lower case, depending on which you put after the word case. Good luck scripting.
There are currently 1 users browsing this thread. (0 members and 1 guests)