How to Help with Scripting

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderator: Committer

Message
Author
User avatar
Sloth
Content Scripter
Posts: 685
Joined: Sat Mar 17, 2007 12:28 am

Re: How to Help with Scripting

#16 Post by Sloth » Tue Jan 08, 2013 9:58 am

Here is another big batch of crosslinks, mostly between ship hulls and required buildings. Also corrected some wrong info caused by recent changes to organic hulls rebalancing.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

All released under the GNU GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0 licences.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: How to Help with Scripting

#17 Post by eleazar » Thu Jan 17, 2013 12:30 am

revision 5649.
"another big batch of crosslinks, mostly between ship hulls and required buildings by sloth."

Excellent.

Future note:
rather than this:
"... allows development of Protoplasmic Hulls, Symbiotic Hulls, ..."
where the "s" is not part of the link and thus stands out, you could phrase it thus:
"... allows development of the Protoplasmic Hull, the Symbiotic Hull, ..."

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12268
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: How to Help with Scripting

#18 Post by Geoff the Medio » Thu Jan 17, 2013 12:36 am

eleazar wrote:rather than this:
"... allows development of Protoplasmic Hulls, Symbiotic Hulls, ..."
where the "s" is not part of the link and thus stands out, you could phrase it thus:
"... allows development of the Protoplasmic Hull, the Symbiotic Hull, ..."
I'd drop the articles and just put "... allows development of Protoplasmic Hull, Symbiotic Hull, ..."

unjashfan
Creative Contributor
Posts: 175
Joined: Fri Dec 30, 2011 8:08 am

Re: How to Help with Scripting

#19 Post by unjashfan » Thu Jan 17, 2013 9:22 am

I'd drop the articles and just put "... allows development of Protoplasmic Hull, Symbiotic Hull, ..."
It feels more natural with the articles. I would keep the articles for the first and last object and omit the rest: "...allows development of the Protoplasmic Hull, Symbiotic Hull, and the Bio-Adaptive Hull." something like that.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12268
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: How to Help with Scripting

#20 Post by Geoff the Medio » Thu Jan 17, 2013 9:39 am

unjashfan wrote:...It feels more natural...
Define "natural"?

Many (most?) content descriptions avoid articles, eg. "Increases industry on..." not "Increases the industry on..."

User avatar
Snowflake
Krill Swarm
Posts: 13
Joined: Sat Aug 10, 2013 4:31 am

Re: How to Help with Scripting

#21 Post by Snowflake » Fri Aug 30, 2013 11:48 pm

Is the Scripting Work page on the wiki still relevant? If so I would like to work on some of the ship tasks.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: How to Help with Scripting

#22 Post by eleazar » Fri Aug 30, 2013 11:50 pm

Snowflake wrote:Is the Scripting Work page on the wiki still relevant? If so I would like to work on some of the ship tasks.
I don't believe any of those things have been done yet.

User avatar
Snowflake
Krill Swarm
Posts: 13
Joined: Sat Aug 10, 2013 4:31 am

Re: How to Help with Scripting

#23 Post by Snowflake » Sat Aug 31, 2013 12:29 am

Edited to contain fixes and workarounds.
Here is a go at giving ships variable speeds depending on species.


Species.txt :

Code: Select all

//#####     S T A R L A N E  S P E E D     #####//

POOR_ENGINES
'''EffectsGroup
            scope = And [
                Source
                Ship
            StarlaneSpeed low = 40
			]
            effects = SetStarlaneSpeed Value - 20
'''

BAD_ENGINES
'''EffectsGroup
            scope = And [
                Source
                Ship
            StarlaneSpeed low = 30
			]
            effects = SetStarlaneSpeed Value - 10
'''

GOOD_ENGINES
'''EffectsGroup
            scope = And [
                Source
                Ship
            StarlaneSpeed low = 1
			]
            effects = SetStarlaneSpeed Value + 10
'''

GREAT_ENGINES
'''EffectsGroup
            scope = And [
                Source
                Ship
            StarlaneSpeed low = 1
			]
            effects = SetStarlaneSpeed Value + 20
'''

ULTIMATE_ENGINES
'''EffectsGroup
            scope = And [
                Source
                Ship
            StarlaneSpeed low = 1
			]
            effects = SetStarlaneSpeed Value + 40
'''


en.txt (stringtables folder) under Species Picks heading:

Code: Select all


POOR_ENGINES
'''−−	Ships are 20 uu per turn slower.'''

BAD_ENGINES
'''−	Ships are 10 uu per turn slower.'''

GOOD_ENGINES
'''+	Ships are 10 uu per turn faster.'''

GREAT_ENGINES
'''++	Ships are 20 uu per turn faster.'''

ULTIMATE_ENGINES
'''+++	Ships are 40 uu per turn faster.'''
It works just like any other species bonus/malus.
Edited to contain fixes and workarounds.
Immobile ships will now not be affected and slow ships will not grind to a halt with ships now being given a minimum speed of 20-29 uu per turn.
This code is released under: Creative Commons Attribution-ShareAlike 3.0 license, and the GNU GPL 2.0 license.
Last edited by Snowflake on Sat Aug 31, 2013 3:40 am, edited 2 times in total.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: How to Help with Scripting

#24 Post by eleazar » Sat Aug 31, 2013 2:17 am

Snowflake, cool, did you test it?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12268
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: How to Help with Scripting

#25 Post by Geoff the Medio » Sat Aug 31, 2013 2:24 am

Snowflake wrote:'''−− Ships are 20 uus slower.'''
What's with the weird accented a's? Writing something in MS word and pasting fancy dashes into what should be UTF-8 text?

Also, never write "uus". Unit symbols don't get an s to be plural, and the point here is that it's a distance per turn, so put "uu/turn".

Also, these scripts are potentially problematic for ship designs that by default move 20 or fewer uu/turn, or for designs that aren't supposed to be able to move.

User avatar
Snowflake
Krill Swarm
Posts: 13
Joined: Sat Aug 10, 2013 4:31 am

Re: How to Help with Scripting

#26 Post by Snowflake » Sat Aug 31, 2013 2:46 am

eleazar wrote:Snowflake, cool, did you test it?
Yes and it works, but my first few tries at a % increase/decrease failed so I went with a flat one.
Geoff the Medio wrote:
Snowflake wrote:'''−− Ships are 20 uus slower.'''
What's with the weird accented a's? Writing something in MS word and pasting fancy dashes into what should be UTF-8 text?

Also, never write "uus". Unit symbols don't get an s to be plural, and the point here is that it's a distance per turn, so put "uu/turn".

Also, these scripts are potentially problematic for ship designs that by default move 20 or fewer uu/turn, or for designs that aren't supposed to be able to move.
The weird text was what was in the code so I went with what was there. They supposedly represent the "-" that appear before the text on the species selection screen.
I will change the uus to uu/turn and try to find a workaround for nonmoving/slowmoving ships.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12268
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: How to Help with Scripting

#27 Post by Geoff the Medio » Sat Aug 31, 2013 2:50 am

Snowflake wrote:The weird text was what was in the code so I went with what was there. They supposedly represent the "-" that appear before the text on the species selection screen.
I think you're not viewing the stringtable with a good text editor then. You need one that reads and saves as UTF-8. Some of those are minus signs, −, which are not the same character as hyphens, -.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: How to Help with Scripting

#28 Post by eleazar » Sat Aug 31, 2013 2:59 am

Off the top of my head all ships have a speed much greater than 20uu, but skipping the negative version of the pick would be fine by me too.

Can we use a tag to distinguish immobile hulls from the rest?

User avatar
Snowflake
Krill Swarm
Posts: 13
Joined: Sat Aug 10, 2013 4:31 am

Re: How to Help with Scripting

#29 Post by Snowflake » Sat Aug 31, 2013 3:42 am

Geoff the Medio wrote:
Snowflake wrote:The weird text was what was in the code so I went with what was there. They supposedly represent the "-" that appear before the text on the species selection screen.
I think you're not viewing the stringtable with a good text editor then. You need one that reads and saves as UTF-8. Some of those are minus signs, −, which are not the same character as hyphens, -.
I tried a different text program and you were right. The fault was with my text editor.

Chriss
Dyson Forest
Posts: 231
Joined: Sun May 11, 2008 10:50 am

Re: How to Help with Scripting

#30 Post by Chriss » Fri Feb 28, 2014 9:45 am

Could someone please drop some hints on script debugging in here or on the Wiki? As in: where do I find error messages caused by scripting? I did look at freeorion.log and freeoriond.log, but that is so cluttered with a myriad of other stuff... Since I caught hints of the code using some kind of logging facility, could effects messages be split off into another file?
Attached patches are released under GPL 2.0 or later.

Post Reply