SRL Archive - Help

Not sure how to phrase this.


KeepBotting

2012-09-14 21:55:56

Erm…how would I make it so the user can specify something (such as a color) and I can make the script do it? Sorry I sound so stupid, I'm really tired right now.

Sort of like Narcle's Fast Fighter, where the user inputs the color and UpText and the script will use that color and UpText while looking for the monster.

Nebula

2012-09-14 22:00:54

Have a user enter it as a constant

const
MonsterColor = 12345678;



riwu

2012-09-14 22:03:06

Const
MonsterColor=123456;

procedure Fight;
begin
FindColorsSpiralTolerance(x,y,MonsterColor,blabla);
//rest of stuff
end;
Though the SRL standard says you should use all CAPS for Const, i prefer camel case for readability ;)

Runaway

2012-09-14 22:17:24

From: riwu
Though the SRL standard says you should use all CAPS for Const, i prefer camel case for readability ;)


I believe the standard is CAPS_N_UNDERSCORES to maintain readability :p

@KB, you can also declare it in DeclarePlayers if you're using multiplayer to allow for different inputs for each player:


procedure DeclarePlayers;
Players[0].Name := 'fightinstuff';
Players[0].Integers[0] := 12345678;
//etc...

litoris

2012-09-15 01:33:49

^Was gonna say that, the players record includes arrays of strings and integers and whatnot, so you can just get the color declared there, and thus different accounts could have different settings.

KeepBotting

2012-09-15 06:53:20

From: riwu
Const
MonsterColor=123456;

procedure Fight;
begin
FindColorsSpiralTolerance(x,y,MonsterColor,blabla);
//rest of stuff
end;
Though the SRL standard says you should use all CAPS for Const, i prefer camel case for readability ;)
When I do that it throws a type mismatch.

riwu

2012-09-15 07:01:17

From: KeepBotting
When I do that it throws a type mismatch.

Uhm should be (MSCX,MSCY,TPA,MonsterColor, …). Too lazy to type all the parameters XD.

KeepBotting

2012-09-15 07:13:24

From: riwu
Uhm should be (MSCX,MSCY,TPA,MonsterColor, …). Too lazy to type all the parameters XD.

Oh, okay.
But if I want to use a simple FindObj?

riwu

2012-09-15 07:22:25

From: KeepBotting
Oh, okay.
But if I want to use a simple FindObj?

Then just do what u normally do except replacing the color parameter with MonsterColor.

KeepBotting

2012-09-15 07:29:11

From: riwu
Then just do what u normally do except replacing the color parameter with MonsterColor.
That threw a type mismatch. http://puu.sh/15hyD

litoris

2012-09-15 07:36:54

Then don't use findobj? It's primitive.

KeepBotting

2012-09-15 07:38:26

From: litoris
Then don't use findobj? It's primitive.
Okay :D

riwu

2012-09-15 07:50:26

From: KeepBotting
That threw a type mismatch. http://puu.sh/15hyD

Is that USERNAME a string? Show ur Const and the procedure.