Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

StartScript with additional parameters

Give us your input on how we may improve the ScriptAPI in the game in future versions.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 25

StartScript with additional parameters

Post by JakSparro98 » Fri Sep 29, 2017 12:35 am

To quickly adjust some effects of scripts in runtime I would suggest adding the possibility to start a script as functions like StartScript Example("hello",4).

With a string parser could be possible do the trick, since, as I think, the command searches for a script name matching the string, once the parser find a bracket in the input string it splits it in two, one for the name search and the other piece is parsed again to extract the parameters.

In a script that can handle extra parameters there will be a function to catch external data passed from the console:

Code: Select all

public void main(ScriptArgs[] args)
{
	foreach(ScriptArgs temp in args)
	{
	//some code
	}
}
The ScriptArgs class will provide only one attribute, his only purpose is to act as bridge from the command interface to the script interface.

Object Content -gets the object of the parameter.
1 x

User avatar
Danger Ross
Superfighter
Superfighter
Posts: 154
Joined: Thu Mar 31, 2016 12:56 am
Title: Dangerous
SFD Alias: Danger Ross
Started SFD: 14 june 2012 (launch day)
Location: California
Gender:
Age: 23

Post by Danger Ross » Fri Sep 29, 2017 2:48 pm

I'm sure some form of this would be implemented once Gurt adds chat reading.
1 x
sorry bucko, you can't punch with swords 8-)

Post Reply