Beginner modded using SE

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Beginner modded using SE

Post by Akalay » Sat, 15. Feb 14, 01:06

Hello, I am a junior modded that wants to learn, problem is, my best way of learning is to see a detailed overlay of a mod then reverse engineer it, so wth that in mind, can someone tell me what is wrong with this script I wrote?

Intention: find relation of a selected race to myself or vice versa, then a message is to be sent with the results.

Results so far: I get a blank message.

001. $racerelation = [playership] -> get notoriety to race split
002. [playership] -> send incoming message: text = $racerelation temporary = [false]
003. Return null

Ps. Took picture but using phone, can't seem to upload it.[/img]

Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 » Sat, 15. Feb 14, 01:37

Try:

Code: Select all

$racerelation = [Playership] -> get notoriety to race [Split]
[Playership] -> send incoming message: text = $racerelation temporary = [false]
return null

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 01:46

I don't see a difference between the two scripts, can you explain a bit more?

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 01:49

Or is that to the displaying of code on this site?

Guest

Post by Guest » Sat, 15. Feb 14, 01:59

Akalay wrote:Or is that to the displaying of code on this site?
... look into Ur script folder: there U´ll find a file named "x2script.xsl"
... if you create a script and open it with internet explorer AND the file above is in the same folder, then U´ll get Ur script code displayed in the browser
... and to post code you have to post 2 so-called "tags" (in this case:

Code: Select all

-tags)
... everything you write between both [code]-tags will be displayed in those code-"frame"
// the second [code]-tag (= so-called "closing tag") must have a "/" in it before "code"

(code)... here some text etc.(/code)
// but the brackets must be "[" and "]"
Last edited by Guest on Sat, 15. Feb 14, 02:03, edited 1 time in total.

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 02:02

I'm on an iPhone, I have no actual internet access by way of the computer I am using.

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 02:09

However I will keep that in mind when I get Internet, but more importantly, I would like to know how that simple, straightforward seeming script doesn't work.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sat, 15. Feb 14, 02:40

As the relation is an integer you might need to format it into a string first (e.g. $msg = sprintf '%s' $racerelation,null, null,null,null). Note that in X sprintf always uses %s regardless of datatype.
Last edited by Shimrod on Sat, 15. Feb 14, 02:47, edited 1 time in total.

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 02:47

I made a couple attempts as understanding that reply and implementing it, but to no avail. I may have a misunderstand of the advice given, I understand that as I should add a ($plship = convert number $racerelation to string) line in, but that doesn't change anything.

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 02:50

The only modding and scripting I've ever done is on warcraft III and starcraft brood wars, this is much more complex, so please forgive my immense ignorance to the codes and lines used by the SE of X3TC.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sat, 15. Feb 14, 02:54

This worked for me:

Code: Select all

$notoriety = [Playership] -> get notoriety to race [Split] 
$msg = sprintf: fmt='Relation=%s', $notoriety, null, null, null, null
[Playership] -> send incoming message: text = $msg temporary = [false] 
return 0
I recommend X-Studio rather than the ingame editor. The best intro to scripting is the MCSI handbook in the x2 bonus material download.
http://www.egosoft.com/download/x2/bonu ... ownload=97

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 03:02

Line 002, how do I make the first null input say relation like that, mine adds a $ and doesn't allow other characters.

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 03:04

And I will definitely download that, when I get a good internet connection, may take it to a friends house.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sat, 15. Feb 14, 03:08

Via the ingame editor after selecting sprintf, I entered 'msg' to its first prompt. Select the first null and push enter, select <string> and enter 'Relation=%s'. Seriously, try X-Studio, its much easier. You can either free type it or double click the command from a menu to auto insert it.
Last edited by Shimrod on Sat, 15. Feb 14, 03:14, edited 1 time in total.

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 03:11

Okay, I'm receiving feedback, but it says Relation=0, I'm a split comrade 96%. What's this about?

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sat, 15. Feb 14, 03:17

I've not used the notoriety commands extensively but I suspect you want 'get notoriety from <race> to race <race>'. The one you're using might reflect the ship's friend/foe config, or maybe that individual ship's standing with the race (perhaps applicable to npc race ships)

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 03:25

Same thing happened, I'll keep tinkering with it though. If you think of anything else, let me know. Thanks for the help so far!

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 03:26

Got it!!! Had the variables flipped around. Thank you a bunch, mate!

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sat, 15. Feb 14, 03:29

Only that you need to specify from race [Split] to race [Player] rather than vice versa. I use this same code in Custom Start to populate the notoriety menu so it demonstrably works.

Code: Select all

while $idx < $Amount
$Race = $Choice.Relations.Races[$idx]
$Notoriety = get notoriety from race $Race to race [Player]
append $Notoriety to array $Choice.Relations.Notorieties
inc $idx
end

Akalay
Posts: 70
Joined: Thu, 28. Oct 10, 01:45

Post by Akalay » Sat, 15. Feb 14, 03:32

I'm not using custom start until I learn a bit more, my scenario is the savage split. Completely side topic, my scenarios appear and disappear at random, what's this about?

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”