[Discussion] Generic X3TC S&M questions I
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
i dont know the exact formula used, but i do know that its based soley on the relval of the product.
the number of products and resources needed are based on the relval of the resources that are added.
each resource type has a coefficent, ie tech wares relval is used differently to a mineral ware, etc
so slight changes to relval in the resources can considerably alter the number of products per cycle
the number of products and resources needed are based on the relval of the resources that are added.
each resource type has a coefficent, ie tech wares relval is used differently to a mineral ware, etc
so slight changes to relval in the resources can considerably alter the number of products per cycle
That's the lifetime I'd say.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Ahh cool thanks, ok and now for another question
[Find.Expand]
What does it do? it seems to be used in the find.gate commands, but I'm unsure of what it does... I'm trying to use the find.gate to do a quick -is this sector jumpable (find.jumpable) but the stock scripts use this flag too, so I thought I would as well.. but its giving false positives.
Does find.expand|find.jumpable do something like... does this gate eventually link to a gate that fulfils the other criteria?
The exact flags I'm using are:
017 $flags = [Find.Nearest] | [Find.Expand] | [Find.JumpableGate]
018 skip if not [OWNER] == Player
019 |$flags = $flags | [Find.Known]
*edit* I've since taken out find.nearest (as I didn't actually need it..). Also the false positives could be caused by multiple reasons, but this one seemed like the most likely
[Find.Expand]
What does it do? it seems to be used in the find.gate commands, but I'm unsure of what it does... I'm trying to use the find.gate to do a quick -is this sector jumpable (find.jumpable) but the stock scripts use this flag too, so I thought I would as well.. but its giving false positives.
Does find.expand|find.jumpable do something like... does this gate eventually link to a gate that fulfils the other criteria?
The exact flags I'm using are:
017 $flags = [Find.Nearest] | [Find.Expand] | [Find.JumpableGate]
018 skip if not [OWNER] == Player
019 |$flags = $flags | [Find.Known]
*edit* I've since taken out find.nearest (as I didn't actually need it..). Also the false positives could be caused by multiple reasons, but this one seemed like the most likely
the find gate command will search for gates in the current sector, as its a sector search routine.
the expand flags expands this search into the universe, this only works along side Find.Nearest.
basically, if you just use find.nearest, u get the nearest gate in the sector if there is one.
if you use it, it will expand out sector by sector until it finds the nearest viable gate to you
the expand flags expands this search into the universe, this only works along side Find.Nearest.
basically, if you just use find.nearest, u get the nearest gate in the sector if there is one.
if you use it, it will expand out sector by sector until it finds the nearest viable gate to you
Q: When a ship is killed, is it still running its original task 0 task?
e.g. I want to replace the signal signal.killed, but I want it to only run on ships running my scripts. So is using the following statement valid? Or does the task 0 get stopped prior to signal.killed being run?
e.g. I want to replace the signal signal.killed, but I want it to only run on ships running my scripts. So is using the following statement valid? Or does the task 0 get stopped prior to signal.killed being run?
Code: Select all
if [THIS] is script 'myscript' on stack of scripts on task 0
do stuff stuff
else
call script !ship.signal.killed (the stock ego soft one)
end
return null
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
Two ideal ways.s9ilent wrote:Q: When a ship is killed, is it still running its original task 0 task?
e.g. I want to replace the signal signal.killed, but I want it to only run on ships running my scripts. So is using the following statement valid? Or does the task 0 get stopped prior to signal.killed being run?
Code: Select all
if [THIS] is script 'myscript' on stack of scripts on task 0 do stuff stuff else call script !ship.signal.killed (the stock ego soft one) end return null
You could set the signal individually for each ship. E.g. at the top of 'myscript'' connect the signal via "[THIS]->connect ship command/signal", or preferably "[THIS]->add secondary signal".
Second way is to make it global, but have myscript set a local variable on the ship to flag it should use the alternative signal, e.g.
Code: Select all
if [THIS]->get local variable: name='mysigkilled.enabled'
do stuff stuff
else
call script !ship.signal.killed (the stock ego soft one)
end
I'm hoping to specifically overwrite the stock script, as I want to replace the on death message. (I want to do lots of other stuff, but they could easily be done on a sec signal)
The use of a global variable is not recommended either, as it will not pick up the issue that the script may not be running (as it could've been terminated)
Q: Which once again leads to the original question, is the ships original task 0 still running, when the signal.killed is fired?
Also, on a similar note
Q: The signal.killed arguments, what do they do?
killer, the killer, obvious
cmd, the command, obvious
cmd targ1, the command target, obvious
cmd targ 2, the cmd target 2, obvious
cmd par1 ????
cmd par2 ????
Given that the signal uses this line: I can only assume.. they are command arguments... but on the other hand, par ~ partner?
Another question...
Q: ... Where/ how to I over write the stock logbook message on ship death.. I thought it was in the signal.killed.. but its not
The use of a global variable is not recommended either, as it will not pick up the issue that the script may not be running (as it could've been terminated)
Q: Which once again leads to the original question, is the ships original task 0 still running, when the signal.killed is fired?
Also, on a similar note
Q: The signal.killed arguments, what do they do?
killer, the killer, obvious
cmd, the command, obvious
cmd targ1, the command target, obvious
cmd targ 2, the cmd target 2, obvious
cmd par1 ????
cmd par2 ????
Given that the signal uses this line:
Code: Select all
START $newleader->command $cmd : arg1=$cmdtarget, arg2=$cmdtarget2, arg3=$cmdpar1, arg4=$cmdpar2
Another question...
Q: ... Where/ how to I over write the stock logbook message on ship death.. I thought it was in the signal.killed.. but its not
no its not still running, as the signal script also runs on task 0, so it'll overright its9ilent wrote:I'm hoping to specifically overwrite the stock script, as I want to replace the on death message. (I want to do lots of other stuff, but they could easily be done on a sec signal)
The use of a global variable is not recommended either, as it will not pick up the issue that the script may not be running (as it could've been terminated)
Q: Which once again leads to the original question, is the ships original task 0 still running, when the signal.killed is fired?
those 4 are just the arguments of the command.s9ilent wrote:Also, on a similar note
Q: The signal.killed arguments, what do they do?
killer, the killer, obvious
cmd, the command, obvious
cmd targ1, the command target, obvious
cmd targ 2, the cmd target 2, obvious
cmd par1 ????
cmd par2 ????
Given that the signal uses this line:I can only assume.. they are command arguments... but on the other hand, par ~ partner?Code: Select all
START $newleader->command $cmd : arg1=$cmdtarget, arg2=$cmdtarget2, arg3=$cmdpar1, arg4=$cmdpar2
targ1 and targ2 is usually defined as the 2 targets, par1 and par2 stand for parameter 1 and 2.
its just additional arguments for your command
this is hardcoded when the ship is killed, so you cant remove it, only add your own on tops9ilent wrote:Another question...
Q: ... Where/ how to I over write the stock logbook message on ship death.. I thought it was in the signal.killed.. but its not
If the secondary signal fires first and your secondary signal includesCycrow wrote:this is hardcoded when the ship is killed, so you cant remove it, only add your own on top
set owner race: neutral race,
the hardcoded signal should not write a log message because it isn't your ship any more? =)
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Hmmm... this comes as a mixed blessing :(:S<3</3
@ Gazz, Thanks for the tip
@ Cycrow. But I thought that signals where interrupts, so shouldn't the higher priority signal.killed script just be on the top of the stack, but the main script still there (just not being run at the time due to its 0 priority)?
I don't suppose someone could explain to me how priorities work?
*Edit* Just to clarify what I said earlier, when I said ".. is it still running.." I mean to say, is it still on the stack of scripts on task 0
@ Gazz, Thanks for the tip
@ Cycrow. But I thought that signals where interrupts, so shouldn't the higher priority signal.killed script just be on the top of the stack, but the main script still there (just not being run at the time due to its 0 priority)?
I don't suppose someone could explain to me how priorities work?
*Edit* Just to clarify what I said earlier, when I said ".. is it still running.." I mean to say, is it still on the stack of scripts on task 0
They are interrupt scripts. Cycrow was just being very literal because the former task 0 script isn't "running" while interrupted. =)
Priorities only rule who can interrupt who.
A Pri 99 interrupt cannot interrupt a Pri 150 script. It merely bounces.
Priorities only rule who can interrupt who.
A Pri 99 interrupt cannot interrupt a Pri 150 script. It merely bounces.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
actually not all signals are interupts
when a ship is killed, the task on that ship is stoped as part of this process.
this usually happens before the signal scripts are fired. So the signal script will not interupt anything.
there are a few other interupts that are also not interupts, but these run on seperate tasks as to not interfere with the current script command
when a ship is killed, the task on that ship is stoped as part of this process.
this usually happens before the signal scripts are fired. So the signal script will not interupt anything.
there are a few other interupts that are also not interupts, but these run on seperate tasks as to not interfere with the current script command
-
- Posts: 12
- Joined: Thu, 30. Jul 09, 10:30
Take out ships that keep apearing every 10 min
How can u take out ships that keep apearing every 10 min? Does anyone know how this can be done?
Re: Take out ships that keep apearing every 10 min
What ships?badboy_COD wrote:How can u take out ships that keep apearing every 10 min?
Thanks for the replies, but I've got more questions (Again ). On a similar but different note, I've tried to create secondary signals for buying and selling wares.
Q: Why aren't my secondary buy/sell signals working?
*** resolved ***
I set the priority to > 0 and it works, (Specifically I set it to.. 10 so its the same as signal.docked)
This is the main command: plugin.sfm.ship.loop
001 [THIS] -> set command: COMMAND_TYPE_TRADE_42
002
003
004 [THIS] -> connect ship command/signal SIGNAL_ATTACKED to script 'plugin.sfm.signal.attacked' with prio 100
005
006 [THIS] -> add secondary signal: signal=SIGNAL_BUYWARE, script='plugin.sfm.signal.buyware', prio=0, name='sfm.buyware'
007 [THIS] -> add secondary signal: signal=SIGNAL_SELWARE, script='plugin.sfm.signal.selware', prio=0, name='sfm.selware'
008 [THIS] -> add secondary signal: signal=SIGNAL_DOCKED, script='plugin.sfm.signal.docked', prio=0, name='sfm.docked'
...
But neither the buy nor sell signals is firing.
(The attacked and docked signal work fine thou)
Here is the actual buy signal: plugin.sfm.signal.buyware
-The restore command removes the signals and does clean up
-I tried putting in log book prints on top of the restore, and on line 1, but I saw no messages (and this was after I restarted the command)
001 $scr.var.data = 'plugin.sfm.data'
002
003 $scr.var.sta = 'plugin.sfm.stat'
004
005
006
007
008 if not [THIS] -> is script 'plugin.sfm.ship.loop' on stack of task=0
009 |@ = [THIS] -> call script 'plugin.sfm.signal.restore' :
010 |return null
011 end
012
013 $com.av = 5
014 $com.pr = 25
015
016 if [HOMEBASE] -> exists
017 |$global = get global variable: name=$scr.var.sta
018 |if $global[2]
019 ||$hb.data = [HOMEBASE] -> get local variable: name=$scr.var.data
020 ||if not $hb.data
021 |||$hb.data = = array alloc: size=5
022 |||$hb.data[0] = 0
023 |||$hb.data[1] = 0
024 |||$hb.data[2] = 0
025 |||$hb.data[3] = 0
026 |||$time = = playing time
027 |||$hb.data[4] = $time
028 |||[HOMEBASE] -> set local variable: name=$scr.var.data value=$hb.data
029 ||end
030 ||$earnt = $hb.data[0]
031 ||$hb.com = $hb.data[2]
032 ||$earnt = $earnt + $amt * $price
033 ||$hb.data[0] = $earnt
034 |end
035 end
036
037
038 $avprice = = get average price of ware $ware
039 $com = $avprice * $amt * $com.av / 1000
040
041
042 if $hb.data
043 |$hb.com = $hb.com + $com
044 |$hb.data[2] = $hb.com
045 end
046
047
048 if $price < $avprice
049 |$price = $avprice - $price
050 |$com.pr = $price * $amt * $com.pr / 1000
051 |
052 |
053 |if $hb.data
054 ||$hb.com.pr = $hb.data[3]
055 ||$hb.com.pr = $hb.com.pr + $com.pr
056 ||$hb.data[3] = $hb.com.pr
057 |end
058 |
059 |$com = $com + $com.pr
060 |
061 end
062 $task = = [THIS] -> get next available task: starting=100
063 [THIS] -> start task $task with script 'plugin.sfm.ship.transact.com' and prio 0: arg1=$com arg2=null arg3=null arg4=null arg5=null
064
065
066
067
068
069 return null
Q: Why aren't my secondary buy/sell signals working?
*** resolved ***
I set the priority to > 0 and it works, (Specifically I set it to.. 10 so its the same as signal.docked)
This is the main command: plugin.sfm.ship.loop
001 [THIS] -> set command: COMMAND_TYPE_TRADE_42
002
003
004 [THIS] -> connect ship command/signal SIGNAL_ATTACKED to script 'plugin.sfm.signal.attacked' with prio 100
005
006 [THIS] -> add secondary signal: signal=SIGNAL_BUYWARE, script='plugin.sfm.signal.buyware', prio=0, name='sfm.buyware'
007 [THIS] -> add secondary signal: signal=SIGNAL_SELWARE, script='plugin.sfm.signal.selware', prio=0, name='sfm.selware'
008 [THIS] -> add secondary signal: signal=SIGNAL_DOCKED, script='plugin.sfm.signal.docked', prio=0, name='sfm.docked'
...
But neither the buy nor sell signals is firing.
(The attacked and docked signal work fine thou)
Here is the actual buy signal: plugin.sfm.signal.buyware
-The restore command removes the signals and does clean up
-I tried putting in log book prints on top of the restore, and on line 1, but I saw no messages (and this was after I restarted the command)
001 $scr.var.data = 'plugin.sfm.data'
002
003 $scr.var.sta = 'plugin.sfm.stat'
004
005
006
007
008 if not [THIS] -> is script 'plugin.sfm.ship.loop' on stack of task=0
009 |@ = [THIS] -> call script 'plugin.sfm.signal.restore' :
010 |return null
011 end
012
013 $com.av = 5
014 $com.pr = 25
015
016 if [HOMEBASE] -> exists
017 |$global = get global variable: name=$scr.var.sta
018 |if $global[2]
019 ||$hb.data = [HOMEBASE] -> get local variable: name=$scr.var.data
020 ||if not $hb.data
021 |||$hb.data = = array alloc: size=5
022 |||$hb.data[0] = 0
023 |||$hb.data[1] = 0
024 |||$hb.data[2] = 0
025 |||$hb.data[3] = 0
026 |||$time = = playing time
027 |||$hb.data[4] = $time
028 |||[HOMEBASE] -> set local variable: name=$scr.var.data value=$hb.data
029 ||end
030 ||$earnt = $hb.data[0]
031 ||$hb.com = $hb.data[2]
032 ||$earnt = $earnt + $amt * $price
033 ||$hb.data[0] = $earnt
034 |end
035 end
036
037
038 $avprice = = get average price of ware $ware
039 $com = $avprice * $amt * $com.av / 1000
040
041
042 if $hb.data
043 |$hb.com = $hb.com + $com
044 |$hb.data[2] = $hb.com
045 end
046
047
048 if $price < $avprice
049 |$price = $avprice - $price
050 |$com.pr = $price * $amt * $com.pr / 1000
051 |
052 |
053 |if $hb.data
054 ||$hb.com.pr = $hb.data[3]
055 ||$hb.com.pr = $hb.com.pr + $com.pr
056 ||$hb.data[3] = $hb.com.pr
057 |end
058 |
059 |$com = $com + $com.pr
060 |
061 end
062 $task = = [THIS] -> get next available task: starting=100
063 [THIS] -> start task $task with script 'plugin.sfm.ship.transact.com' and prio 0: arg1=$com arg2=null arg3=null arg4=null arg5=null
064
065
066
067
068
069 return null
Last edited by s9ilent on Sun, 9. Aug 09, 05:07, edited 1 time in total.
I'm trying to get any kind of reaction out of Send SIGNAL_DOCKED but so far, without success.
I attach SIGNAL_DOCKED to the ship in any way I could find:The priority of the default signal is 10 so this should always go through.
'a...a.SIGNAL.DOCK.SCR' is just a test script that writes all arguments to a log file.
So then I send the signal...The wait is only there so I can test sending the signal delayed, while the ship is docked.
The ship is running a priority 0 script on task 0.
When I send the signal, nothing happens.
I tried sending the signal from the outside (global script), from a high task ID on the object, and from task 0 on the object.
No go. No signal.
The log file shows "Send signal docked" but the actual signal script is never started.
So far the only way to get the signal to fire is when the ship has slowly meandered through the docking approach.
But that can not be the point of Send Signal so I must be missing something...
I attach SIGNAL_DOCKED to the ship in any way I could find:
Code: Select all
001 $Target = get player tracking aim
002
003 $Target -> add secondary signal: signal=SIGNAL_DOCKED, script='a...a.SIGNAL.DOCK.SCR', prio=4800, name='SIG.DOCK'
004
005 global secondary signal map: add signal=SIGNAL_DOCKED race=Player class=Ship script='a...a.SIGNAL.DOCK.SCR' prio=4900 name='SIG.DOCK.2'
006
007 global script map: set: key=SIGNAL_DOCKED, class=Ship, race=Player, script='a...a.SIGNAL.DOCK.SCR', prio=5000
'a...a.SIGNAL.DOCK.SCR' is just a test script that writes all arguments to a log file.
So then I send the signal...
Code: Select all
001 $Target = get player tracking aim
002
003 @ = wait 5000 ms
004 @ = wait 5000 ms
005 @ = wait 5000 ms
006
007 write to log file #312 append=[TRUE] printf: fmt='Sending signal docked.'
008
009 $Target -> send signal SIGNAL_DOCKED : arg1='Test.Arg.1', arg2='Test.Arg.2', arg3=null, arg4=null
The ship is running a priority 0 script on task 0.
When I send the signal, nothing happens.
I tried sending the signal from the outside (global script), from a high task ID on the object, and from task 0 on the object.
No go. No signal.
The log file shows "Send signal docked" but the actual signal script is never started.
So far the only way to get the signal to fire is when the ship has slowly meandered through the docking approach.
But that can not be the point of Send Signal so I must be missing something...
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.