SRL Archive - Help and Support

integer vars


Junior

2007-02-17 11:24:46

ok I was just wodering.. When using a function that results with an integer can you just use that function in a procedure or do you have the assign the integer value to a var? I dont really know how to explain this but ill give a example.

with var
roadwalkcolor := FindFaladorRoadColor; //<--function that results as integer
RadialRoadWalk(roadwalkcolor, #, #, #, #, #);
Without var
RadialRoadWalk(FindFaladorRoadColor, #, #, #, #, #);

I was wondering if you can use a function in a procedure like that. Would that work, or do you NEED the variable?

XcanadamanX

2007-02-17 11:47:48

i think you need the var. ive never tried the other way but that would get kinda laggy since you look for the fally road color everytime. or atleast it would on my comp. i would just keep to the first one.

Pentti

2007-02-17 11:54:16

No, you don't need to put it in the vars.
That second code works too, it gets road color same way in both of codes.

If you have like this:
RadialRoadWalk(FindFaladorRoadColor, #, #, #, #, #);
RadialRoadWalk(FindFaladorRoadColor, #, #, #, #, #);
RadialRoadWalk(FindFaladorRoadColor, #, #, #, #, #);
-It will get new road color every time.

If you have like this:
Color:=FindFaladorRoadColor;
RadialRoadWalk(Color, #, #, #, #, #);
RadialRoadWalk(Color, #, #, #, #, #);
RadialRoadWalk(Color, #, #, #, #, #);
-Then it will use everytime only that one color it got.

Junior

2007-02-17 13:51:18

Thanks guys, now I have a better idea of what I sould do.

WhiteShadow

2007-02-17 13:56:38

for that kind of Paramater (var RoadColor : Integer);

then you must use a variable. Also I think RadialRoadWalk is only compatible with the RoadColor variable, or else it won't get new roadcolors for you. :/