Hi.
It just jump over the case?
My question ^^ : Why ?
SCAR Code:case 3 of
0: if PowerChop = 'Yes' then
MainloopPower;
1: if PowerChop = 'No' then
if Tr33Type = 1 then
MainloopYew;
2: If PowerChop = 'No' then
if Tr33Type = 2 then
MainloopWil;
end;
Hi.
It just jump over the case?
My question ^^ : Why ?
SCAR Code:case 3 of
0: if PowerChop = 'Yes' then
MainloopPower;
1: if PowerChop = 'No' then
if Tr33Type = 1 then
MainloopYew;
2: If PowerChop = 'No' then
if Tr33Type = 2 then
MainloopWil;
end;
If it can't find any of the cases (make it true) then it will skip it...
Try instead of yes and no true false, for now as a test...
Also remember that a case is equal to a begin so don't forget to end the case.
Hope this help,
~Stupedspam
True False ??
I don't need that
( No offence :P ) Any1 expariance that can answer![]()
im sure u didn't mean it but stupedspam is experienced,,, lol but i don't get your question please rephrase?
~Spaz
Im trying to make a case that look what the string at settings says.
So if PowerChop = Yes then it should begin MainLoopPower; but if i take it to yes it wont do MainLoopPower?
And sorry for that havnt seen so much of you
With hope - N1keee
You have stated that "incase 3 is 0, 1, or 2 then do something". And incase you didn't know, 3 is only 3 and cannot be 0, 1, or 2.
Instead of setting PowerChop to a string set it to an integer and then do something like:
If you can follow my thoughts?SCAR Code:case PowerChop of
0: WriteLn('Do something...'); //"Yes" could be replaced by 0
1: WriteLn('Do something else...'); //Or by 1 - or 1 could be "no".
2: WriteLn('Do something completely different...'); //Or "yes" or "no" could be 2!
end;
This sentence is false.
im guessing that would workSCAR Code:repeat
if PowerChop = true then
begin
MainloopPower;
break;
end;
if PowerChop = false then
begin
if Tr33Type = 1 then
begin
MainloopYew;
end;
end;
end else
begin
If PowerChop = 'No' then
begin
if Tr33Type = 2 then
begin
MainloopWil;
break;
end;
end;
i := i + 1;
until i := 3;
EDIT: wow yea case powerchop would work way better than mine
EDIT EDIT: make ur yes and no's booleans so its true/false
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess
Yeah, cases is much better in many cases, Dan (sorry had to do it!).
This sentence is false.
Actually in your script, just take out the 0:, 1: and 2: and that would work as you wanted it to as there doesn't seem to be a need for cases in that snippet of script (cases are mainly used when you want to perform a random action, such as in an anti-ban).
So the script would just be
(only added some 'else's in to make it run slightly faster. Might also want to add a last 'else' in case the const's don't match any of those)SCAR Code:if PowerChop = 'Yes' then
MainloopPower
else if PowerChop = 'No' then
if Tr33Type = 1 then
MainloopYew
else if PowerChop = 'No' then
if Tr33Type = 2 then
MainloopWil;
Though Gumleren's method is just as applicable in this situation



Like Gumleren said, just do thisYou didn't have a 3 in there. Just 0, 1, and 2.SCAR Code:case 3 of
1: if PowerChop = 'Yes' then
MainloopPower;
2: if PowerChop = 'No' then
if Tr33Type = 1 then
MainloopYew;
3: If PowerChop = 'No' then
if Tr33Type = 2 then
MainloopWil;
end;
[scar]
for i := 0 to 2 do
case i of
0: if PowerChop = 'Yes' then
MainloopPower;
1: if PowerChop = 'No' then
if Tr33Type = 1 then
MainloopYew;
2: If PowerChop = 'No' then
if Tr33Type = 2 then
MainloopWil;
end;
lol why is everyone posting more complicated stuff(including myself)
case powerchop of would work the best because it has theleast amount of code. And bullzeye doesnt case start at 0?
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess



But.. but!? Come on, people! Read the posts before you post (in this case, my post up there)!
jhildys post can't be used because it goes through EVERY case (because of the for-loop). Bullzeyes post can't be used either because it only goes through the 3rd case (as 3 is always 3 and not 0, 1, or 2).
Mixsters solution was actually good, but I still believe in cases - which also requires less code and is easier to read.
This sentence is false.
Gumleren seems to be the only one with the right answer to the problem.
I would do this:
SCAR Code:case PowerChop of
'Yes': MainloopPower;
'No':
begin
case Tr33Type of
1: MainloopYew;
2: MainloopWil;
end;
end;
end;
-Knives
Also a great solution, I'd say, Knives. Especially in this case where he wants to check Tr33Type too. I'd go for Knives' solution on this particular problem (and proberly many other problems too :P).
This sentence is false.
There are currently 1 users browsing this thread. (0 members and 1 guests)