Here you can request a tutorial on some topic in scripts that doesn't already have a tutorial. Anything from functions to recursion to data storage to returning from functions and anything else you would want to see.
Remember for specific pieces of code you want help with please post in the help me thread (to be made later).
Request explanation of a script topic
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
Crying is not a proper retort!
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
I want to check and see if a mod is loaded.
I tried to place a Global value in such as:
<Globals>
(block nil
(setq testMod "True")
)
</Globals>
And then in another extension, I simply checked the value of testMod-
(if (eq testMod "True")
(setq desc "mod is loaded")
)
This worked fine if the mod is there, but when the mod is not there it gives the error- no binding for testMod
Now, is there a way to check for testMod and avoid having the error show up on the screen? Can I use (isError to do that?
The point is to find an easy way to detect if certain mods are present- now I could use it on a system such as sysSetData- but then if the mod is used in an adventure extension that doesn't have the same nodeID the method breaks. I tried using a typSetGlobalData on a station, but if the station is in a different extension the game won't load.
I tried to place a Global value in such as:
<Globals>
(block nil
(setq testMod "True")
)
</Globals>
And then in another extension, I simply checked the value of testMod-
(if (eq testMod "True")
(setq desc "mod is loaded")
)
This worked fine if the mod is there, but when the mod is not there it gives the error- no binding for testMod
Now, is there a way to check for testMod and avoid having the error show up on the screen? Can I use (isError to do that?
The point is to find an easy way to detect if certain mods are present- now I could use it on a system such as sysSetData- but then if the mod is used in an adventure extension that doesn't have the same nodeID the method breaks. I tried using a typSetGlobalData on a station, but if the station is in a different extension the game won't load.
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
Periculi done see http://neurohack.com/transcendence/foru ... php?t=1788
Crying is not a proper retort!
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
Job list for script and functions:
- New 0.99x functions testers (please join the IRC channel for this)
Basically the job consist in helping to test the new functions and discover how they works
Moreover, you can propose yourself to write a tutorial on a script or a function you know ! Help the community grow (and mod)
- New 0.99x functions testers (please join the IRC channel for this)
Basically the job consist in helping to test the new functions and discover how they works
Moreover, you can propose yourself to write a tutorial on a script or a function you know ! Help the community grow (and mod)
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
Ugh, HELP!
(sysVectorRandom vector number number criteria)
Ok, I see in Huari.xml that George used "t" in criteria to set the uncharted gate.
Now, I thought that that was used for:
* t -> Include stations (including planets)
But the gate gets built in "deep space away from everything"
So, what is the filter doing in:
(sysVectorRandom Nil (random 1200 1500) 300 "t")
And is there a way to randomly choose a planet within a certain range using this function?
(sysVectorRandom vector number number criteria)
Ok, I see in Huari.xml that George used "t" in criteria to set the uncharted gate.
Now, I thought that that was used for:
* t -> Include stations (including planets)
But the gate gets built in "deep space away from everything"
So, what is the filter doing in:
(sysVectorRandom Nil (random 1200 1500) 300 "t")
And is there a way to randomly choose a planet within a certain range using this function?
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
(sysVectorRandom center radius minSeparation [filter]) -> vectorPericuli wrote:Ugh, HELP!
(sysVectorRandom vector number number criteria)
The goal of this function is to return a random position, X, such that:
1. X is 'radius' light-seconds away from 'center'
2. X is at least 'minSeparation' light-seconds away from any object that matches 'filter' criteria. If 'filter' is Nil, then we avoid all objects.
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
Yes.Periculi wrote:Oh, good. Same filters as sysFindObject searches then?
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
I am not sure that works like I think it does.
If I use (sysVectorRandom nil 1000 10 "t") should I expect to get a random location in the middle of no where? How can I select a position near a planet?
If I use (sysVectorRandom nil 1000 10 "t") should I expect to get a random location in the middle of no where? How can I select a position near a planet?
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
Yes. (sysVectorRandom) is designed to find a spot that is not near anything. The "10" in your call is the minimum distance from any "t"; it is not the maximum distance. If you want to pick a random spot near a planet, you can use something like:Periculi wrote:I am not sure that works like I think it does.
If I use (sysVectorRandom nil 1000 10 "t") should I expect to get a random location in the middle of no where? How can I select a position near a planet?
Code: Select all
(sysVectorRandom
(random (sysFindObject Nil "t"))
50
10
)
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
Code: Select all
(filter (sysFindObject gPlayerShip "Es") enemyShip (eq (objGetTarget enemyShip) gPlayerShip))
but please for so specific topics please use the help me thread
Crying is not a proper retort!
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
More than an explanation is a request:
I would like a list with all the hardcoded aGlobals and gGlobals that can be used for each event.
George kindly made a nice list for <OnDamage>:
What about the others ?
I would like a list with all the hardcoded aGlobals and gGlobals that can be used for each event.
George kindly made a nice list for <OnDamage>:
Code: Select all
<OnDamage> Event
gSource = station object
aAttacker = object that attacked
aHitPos = vector position of hit
aHitDir = angle direction from which hit came
aDamageHP = hit points of damage
aDamageType = type of damage
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
a good tutorial would be on how to choose non flat random numbers.
One example would be making a curve with dice throws.
I would also like to see how to make a curve that as it closer to the maximum value it has a greater probability of being chosen.
Any other nice curves would be nice.
A general case method would be also wanted. Where you can give the chances for each value.
One example would be making a curve with dice throws.
I would also like to see how to make a curve that as it closer to the maximum value it has a greater probability of being chosen.
Any other nice curves would be nice.
A general case method would be also wanted. Where you can give the chances for each value.
Crying is not a proper retort!