EnglishGermanFrenchRussianItalianSpanish
Log inRegister
 
Usage of the chance option
Post new topic Reply to topic
View previous topic :: View next topic
Author Message
Browser_ice





Joined: 05 Feb 2006
Posts: 231 on topic

Thank you for registering your game
PostPosted: Sun, 8. Oct 17, 14:49    Post subject: Usage of the chance option Reply with quote Print

Up until a few days ago, I thought the chance option was pretty simple. I thought it only needed a value from 0 to 100 resulting in a % interpretation.

However, recently, I have see usages that makes me wonder how this chance command is reacting.

example:

chance=-84 ==> results in what ?

chance=180 ==> results in what ?

chance=-184 ==> results in what ?


_________________
Steam X-Superbox, playing XR
WIndows-7
Intel I5
16Gb Memory
Nvgidia GT 960
Back to top
View user's profile Send private message
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Feb 2004
Posts: 8966 on topic
Location: Gower, South Wales
Thank you for registering your game
PostPosted: Mon, 9. Oct 17, 00:22    Post subject: Reply with quote Print

Hi Browser_ice,

To my best knowledge your initial thought is correct, i.e. chance values 0 ... 100 correspond to the associated %. That is the same as weight values, for example
Code:

<do_any>
          <signal_cue_instantly cue="md.EuclidsDangerZonesEvent1.EuclidsDangerZonesE1" param="$Epos" weight="$C1"/>     
          <signal_cue_instantly cue="md.EuclidsDangerZonesEvent2.EuclidsDangerZonesE2" param="$Epos" weight="$C2"/>   
          <signal_cue_instantly cue="md.EuclidsDangerZonesEvent3.EuclidsDangerZonesE3" param="$Epos" weight="$C3"/>     
          <signal_cue_instantly cue="md.EuclidsDangerZonesEvent4.EuclidsDangerZonesE4" param="$Epos" weight="$C4"/>     
          <signal_cue_instantly cue="md.EuclidsDangerZonesEvent5.EuclidsDangerZonesE5" param="$Epos" weight="$C5"/>     
</do_any>

where $C1$ to $C5$ are values between 0 and 100.
I'm curious: Where did you see chance values greater than 100?

Cheers Euclid


_________________
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.” - Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Browser_ice





Joined: 05 Feb 2006
Posts: 231 on topic

Thank you for registering your game
PostPosted: Mon, 9. Oct 17, 18:47    Post subject: Reply with quote Print

mining.ship.collect.xml

Code:
         <!-- find pickup (filtered by ownership) and target -->
            <set_value name="$pickuptarget" exact="false"/>
            <set_value name="$skill" exact="(this.combinedskill - 50) * 3" />
            <find_asteroid_in_cluster name="$pickup" cluster="this.cluster" refobject="this.ship" canpickup="true" multiple="true" maxdistance="4km" viewangle="360deg" ware="$checkware" />
            <do_all exact="$pickup.count" counter="$i" reverse="true">
              <do_if value="$pickup.{$i}.owner">
                <remove_value name="$pickup.{$i}" />
              </do_if>
              <do_elseif value="not $pickup.{$i}.canbepickedup">
                <debug_text text="'[Ship=%1, Skills=%5, Mining] %2 in %3 (: %4) cannot be picked up!'.[this.ship.knownname, $pickup.{$i}, $pickup.{$i}.zone.knownname, $.knownname, (this.combinedskill - 50) * 3]" chance="$debugchance"/>
                <remove_value name="$pickup.{$i}" />
              </do_elseif>
              <do_elseif value="$pickup.{$i}.wares.{$checkware}.count le 0" chance="$skill">
                <remove_value name="$pickup.{$i}" />
              </do_elseif>
            </do_all>


The resulting value of (this.combinedskill - 50) * 3 remains the same throughout this script. So when a later debug_text displayed it in the same script, it was sometimes showing negative numbers:
Quote:
Line 216: [Scripts] 23238.85 *** aicontext<mining.ship.collect,0x12041>: [Ship=Miner-Large-Gaz, Skills=-87, Mining] movement started (destination: 31768m)
Line 459: [Scripts] 23319.44 *** aicontext<mining.ship.collect,0x12041>: [Ship=Miner-Large-Gaz, Skills=-87, Mining] movement stopped, preparing to mine
Line 470: [Scripts] 23323.79 *** aicontext<mining.ship.collect,0x12041>: [Ship=Miner-Large-Gaz, Skills=-87, Mining] starting to launch drones
Line 691: [Scripts] 23381.25 *** aicontext<mining.ship.collect,0x22c52>: [Ship=CdB Récolteur de plasma Midir, Skills=21, Mining] collected 421 units of Plasma in zone Première Etape in 21.0884 seconds (19.9837 units/s)
Line 765: [Scripts] 23398.56 *** aicontext<mining.ship.collect,0x22c52>: [Ship=CdB Récolteur de plasma Midir, Skills=21, Mining] collected 346 units of Plasma in zone Première Etape in 17.3161 seconds (19.9837 units/s)
Line 766: [Scripts] 23398.56 *** aicontext<mining.ship.collect,0x22c52>: [Ship=CdB Récolteur de plasma Midir, Skills=21, Mining] OOZ mining: try other ware (Plasma)
Line 795: [Scripts] 23405.45 *** aicontext<mining.ship.collect,0x12041>: [Ship=Miner-Large-Gaz, Skills=-87, Mining] collected 8000 units of Hydrogène (761.6 units/s on average)
Line 796: [Scripts] 23405.45 *** aicontext<mining.ship.collect,0x12041>: [Ship=Miner-Large-Gaz, Skills=-87, Mining] stop launching drones
Line 797: [Scripts] 23405.45 *** aicontext<mining.ship.collect,0x12041>: [Ship=Miner-Large-Gaz, Skills=-87, Mining] less than 5 percent free cargo space
Line 798: [Scripts] 23405.83 *** aicontext<mining.ship.collect,0x11df1>: [Ship=Miner-XL-All, Skills=-150, Mining] collected 75 units of Cristaux in zone Héritage de Magellan in 21.2933 seconds (3.55067 units/s)
Line 853: [Scripts] 23419.84 *** aicontext<mining.ship.collect,0x22c52>: [Ship=CdB Récolteur de plasma Midir, Skills=21, Mining] collected 425 units of Plasma in zone Première Etape in 21.2749 seconds (19.9837 units/s)
Line 854: [Scripts] 23419.84 *** aicontext<mining.ship.collect,0x22c52>: [Ship=CdB Récolteur de plasma Midir, Skills=21, Mining] OOZ mining: try other ware (Plasma)
Line 870: [Scripts] 23425.30 *** aicontext<mining.ship.collect,0x11df1>: [Ship=Miner-XL-All, Skills=-150, Mining] collected 69 units of Cristaux in zone Héritage de Magellan in 19.4659 seconds (3.55067 units/s)
Line 871: [Scripts] 23425.40 *** aicontext<mining.ship.collect,0x227da>: [Ship=CA Mineur de glace Sequana, Skills=-60, Mining] OOZ mining: try other ware (Glace)

In move.generic.xml, it shows one other usage to which I have no idea why it is even coded: chance="0". I mean that if the result of chance=0 is really the equivalent of 0%, then it would not even run that script. Right ?
Code:
        <!-- long distance -->
        <do_if value="$bigship">
          <do_if value="(this.sector == $destination.sector) or ($nojump == true)">
            <debug_text text="'Long distance trip. Using engine booster...'" chance="$debugchance" />
            <run_script name="'move.nohighway'" result="$nohighwayresult">
              <param name="target" value="$destination" />
              <param name="position" value="$position" />
              <param name="debugchance" value="$debugchance" />
            </run_script>
            <run_script name="'move.nohighway'" chance="0" />
            <debug_text text="'boost complete. Moving into final position.'" chance="$debugchance" />
            <do_if value="@$nohighwayresult">
              <do_if value="$endintargetzone">
                <!-- no need to move to a safepos now, we're happy just being here -->
                <return />
              </do_if>
            </do_if>



_________________
Steam X-Superbox, playing XR
WIndows-7
Intel I5
16Gb Memory
Nvgidia GT 960
Back to top
View user's profile Send private message
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)

MEDAL

Joined: 20 Nov 2005
Posts: 13624 on topic

Thank you for registering your game
PostPosted: Mon, 9. Oct 17, 20:08    Post subject: Reply with quote Print

Browser_ice wrote:
In move.generic.xml, it shows one other usage to which I have no idea why it is even coded: chance="0". I mean that if the result of chance=0 is really the equivalent of 0%, then it would not even run that script. Right ?
Code:
...


removing blocking actions like <wait/> or <run_script/> (or changing the order of them) would break savegames. therefore if such a command is not needed anymore because of changes in the script the easiest way to deactivate it is to give it a chanc="0" Wink


for the former case i guess the intention is to randomize the behavior in a certain skill range, and above this range always perform the action, and below it dont perform the action (in other words greater 100 will default to 100 and less than 0 will default to 0)


_________________
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter Wink

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help Wink
Back to top
View user's profile Send private message
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Feb 2004
Posts: 8966 on topic
Location: Gower, South Wales
Thank you for registering your game
PostPosted: Tue, 10. Oct 17, 02:53    Post subject: Reply with quote Print

UniTrader wrote:

.......
for the former case i guess the intention is to randomize the behavior in a certain skill range, and above this range always perform the action, and below it dont perform the action (in other words greater 100 will default to 100 and less than 0 will default to 0)


Indeed, bare in mind that this occurs within a <do_all> node and hence the variable chances are a neat trick to avoid some of the actions to be executed Wink

Cheers Euclid


_________________
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.” - Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic Reply to topic
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Control Panel
Login Data
The time now is Wed, 23. May 18, 07:23

All times are GMT + 2 Hours

[ Disclaimer / Impressum ] | [ Privacy Policy / Datenschutz ]

Board Security

Copyright © EGOSOFT 1989-2018
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.08574 seconds, sql queries = 19