User Tag List

  • Crazy
  • Cool
  • Awesome
  • Angry
  • Happy
  • Hungry
  • Sad
  • Shy
  • Tired
  • Page 1 of 2 12 LastLast
    Results 1 to 10 of 13

    Thread: Are there any tutorial scripts in here?

    1. #1
      TXU New Member Light-in-Heaven's Avatar
      Credits
      45.05
      Points
      200
      Total Contributions For

      Light-in-Heaven      £ 0.00
      Main Info Status and Things Points and Credits Other
      is I enjoy the x3R + XTM:)
       
      I am:
      Happy
       
      Join Date
      16-10-2011
      Posts
      32

      Question Are there any tutorial scripts in here?

      Did anyone in here(The x Universe) wrote script tutorials? If yes,can anyone guide me to a good web page or a link on this site(preferred here) to read script tutorials and the fine details about them? I didn't know where to post this question,so i thought on "The X Universe" forum is apropriate. I think it'd be nice for all who want to learn scripting to have great tutorials..besides,we will not get to the experience of true scripters..They made great stuff. one example is the valhalla spawn ship with its ships in hangar(well..at least i liked that and this came my mind).

      I know just this one
      This is Roguey's page. For basic editing and very easy to understand..If all would be like that,huh? http://x3.roguey.co.uk/edit/
      Oh yeah and this one to..but i can't quite call it a script tuturial since so much is not edited. Thanks in advance.


    2. #2
      TXU's resident chatbox text fiend....... Tritous's Avatar
      Credits
      504.06
      Points
      4,049
      Total Contributions For

      Tritous Points for Shouts      £ 5.00
      Main Info Status and Things Points and Credits Other
      is Dead.
       
      I am:
      Cool
       
      Join Date
      16-03-2006
      Location
      UK, if anywhere
      Posts
      1,164

      Default

      I've been doing light scripting from x2. To be honest, the real key to the scripting is to know basic principles of programming. I learn't to script by pure intuition, it's not that complex a language in my opinion, with very flexible data typing and arrays. Looking at some of the more complex scripts lets you learn a lot too.

      The part that needs more of a tuition is hotkeys, setup and init scripts, ship command handling, etc.

      10 PRINT IDLE
      20 GOTO 10

      "Intelligence is like money: when you pass it on to your kids you lose it for yourself"
      -Me, tired

      TXU Wiki:
      Because we are a community
      Thanks Light-in-Heaven thanked for this post
      Likes Light-in-Heaven liked this post

    3. #3
      TXU New Member Light-in-Heaven's Avatar
      Credits
      45.05
      Points
      200
      Total Contributions For

      Light-in-Heaven      £ 0.00
      Main Info Status and Things Points and Credits Other
      is I enjoy the x3R + XTM:)
       
      I am:
      Happy
       
      Join Date
      16-10-2011
      Posts
      32

      Default Basic script for guys like me

      Quote Originally Posted by Tritous View Post
      Looking at some of the more complex scripts lets you learn a lot too.
      You're right and Thank you Tritious,I've learned a great deal from the complexed scripts(my level). Yet there are some witch are way to complex. They need to be discribed for what purpose serves. For example: I've made a simple script that i read from other 2 scripts made by XTM team(you can only learn from the best). This goes like that
      Arguments: sec.Pos Var/sector position 'Select Sector Position'

      A.Pos = sec.Pos
      B.Pos = sec.Pos
      C.Pos = sec.Pos
      D.Pos = sec.Pos

      $my.ship(any ship) = create ship:type= buster owner= Player addto= D.Pos x= A.Pos y= B.Pos z= C.Pos
      $my.ship->set name to 'Buster - '

      return null
      Before those Positions i use to put 0 as X,Y,Z and addto sector.
      It may be easy to set names,but what i was looking(still do) is how do i name 'Buster - 1" without renaming it manualy. How to name ship with the name i give and with a number countinously in case i create a ship after another and so on.
      I found another page that uses basic scripting yet easy to understand...with images too. That's the one and is made by Cycrow? Isn't he the guy that created the "plugin Manager"? I've added new ships to the game more than once until XTM arrived.


    4. #4
      TXU's resident chatbox text fiend....... Tritous's Avatar
      Credits
      504.06
      Points
      4,049
      Total Contributions For

      Tritous Points for Shouts      £ 5.00
      Main Info Status and Things Points and Credits Other
      is Dead.
       
      I am:
      Cool
       
      Join Date
      16-03-2006
      Location
      UK, if anywhere
      Posts
      1,164

      Default

      yes, cycrow made the plugin manager and LOTS of scripts from X2 onwards.

      Regarding your script; sector position is of type array, size 4, containing (IIRC the order) {x, y, z, sector}. you need to set those 4 variables to the elemnts of the array, not to the array.

      If you want to test, you can use the write to player logbook on virtually anything and while it's a pest to close the editor and check messages, it's a sort of way to test.


      Regarding naming: made one of those myself on the fly in vanilla before i got XTC (which does it for me, thanks). Simplest way: set a global variable with the last number used. each time you run the script, add one, use that number, save that number again.

      10 PRINT IDLE
      20 GOTO 10

      "Intelligence is like money: when you pass it on to your kids you lose it for yourself"
      -Me, tired

      TXU Wiki:
      Because we are a community
      Thanks Light-in-Heaven thanked for this post
      Likes Light-in-Heaven liked this post

    5. #5
      TXU New Member Light-in-Heaven's Avatar
      Credits
      45.05
      Points
      200
      Total Contributions For

      Light-in-Heaven      £ 0.00
      Main Info Status and Things Points and Credits Other
      is I enjoy the x3R + XTM:)
       
      I am:
      Happy
       
      Join Date
      16-10-2011
      Posts
      32

      Default

      Quote Originally Posted by Tritous View Post
      Regarding your script; sector position is of type array, size 4, containing (IIRC the order) {x, y, z, sector}. you need to set those 4 variables to the elemnts of the array, not to the array.
      Do you mean the "<RetVar> = array alloc:size=<Var/Number>"? Can you give me a hint,please? My ship ends up with just the name i gave instead of the auto name the game sets, but i'd wish it renames the ship while adding a + number so all my ships won't be "Buster - " but "Buster - 1" or "Buster - 2" and so on. I know someone/s out there know that.
      Quote Originally Posted by Tritous View Post
      If you want to test, you can use the write to player logbook on virtually anything and while it's a pest to close the editor and check messages, it's a sort of way to test.
      I managed to do this in my ship script:
      Quote Originally Posted by line number
      write to player logbook: printf: fmt:'[white]Sector %s[/white] - [red]X:[/red]%s [red]Y:[/red]%s [red]Z:[/red]%s, D.Pos, A.Pos, B.Pos, C.Pos, null
      That is nice if you want to see what coordinates is the ship you just scripted. Though I don't know why i can't see the "sector" in color (white) as i can see the coordinates.
      Quote Originally Posted by Tritous View Post
      Simplest way: set a global variable with the last number used. each time you run the script, add one, use that number, save that number again.
      Set this in the begining of the script or at the end? Don't i need a statement or a "end" for this? If i do what you're saying,how many times do i have to go in and out of the script and change digits before it adds to name automaticlly.


    6. #6
      TXU's resident chatbox text fiend....... Tritous's Avatar
      Credits
      504.06
      Points
      4,049
      Total Contributions For

      Tritous Points for Shouts      £ 5.00
      Main Info Status and Things Points and Credits Other
      is Dead.
       
      I am:
      Cool
       
      Join Date
      16-03-2006
      Location
      UK, if anywhere
      Posts
      1,164

      Default

      syntax for a an array is the brackets, it's the one where the returned variable = array[index]. Note that indexs are in fact offsets, so range from 0 to size-1.

      if you want the easiest way, just do the simple write to player logbook with the sector position, then you'll see what I mean. You may also see that what you are doing is probably nonsensical for the sector.

      consider the following:

      countervar = get global variable name= bustercount
      skip if not countervar == null
      countervar = 0
      inc countervar
      set global variable name=bustercount value = countervar

      shipname = "buster - " + countervar


      posx = sec.Pos[0]
      posy = sec.Pos[1]
      posz = sec.Pos[2]
      Sector = sec.Pos[3]

      $my.ship(any ship) = create ship:type= buster owner= Player addto= sector x= posx y= posy z= posz
      $my.ship->set name to shipname

      only rough and from memory but that should give you the idea. That you didnt find the right array command though suggests to me you aren't really experienced in any programming languages though. Even though it's only a script, you need to know the philosophies and concepts of programming if you want to do anything of any complexity, otherwise you will always be struggling in an alien world. You should think about some basic courses (everyone should learn to program, it's a useful skill), but focus on ones that teach the philosophies, not just teaching a language. After that you'll probably be able to understand the script engine without much difficulty

      10 PRINT IDLE
      20 GOTO 10

      "Intelligence is like money: when you pass it on to your kids you lose it for yourself"
      -Me, tired

      TXU Wiki:
      Because we are a community
      Thanks Light-in-Heaven thanked for this post
      Likes Light-in-Heaven liked this post

    7. #7
      TXU New Member Light-in-Heaven's Avatar
      Credits
      45.05
      Points
      200
      Total Contributions For

      Light-in-Heaven      £ 0.00
      Main Info Status and Things Points and Credits Other
      is I enjoy the x3R + XTM:)
       
      I am:
      Happy
       
      Join Date
      16-10-2011
      Posts
      32

      Default

      Wow...Thank you so much for your help. This is indeed what i was looking for. I already placed that in my script and it worked. Your memory served you well
      Quote Originally Posted by Tritous View Post
      only rough and from memory but that should give you the idea. That you didnt find the right array command though suggests to me you aren't really experienced in any programming languages though. Even though it's only a script, you need to know the philosophies and concepts of programming if you want to do anything of any complexity, otherwise you will always be struggling in an alien world. You should think about some basic courses (everyone should learn to program, it's a useful skill), but focus on ones that teach the philosophies, not just teaching a language. After that you'll probably be able to understand the script engine without much difficulty
      You're absolutely right,i'm just a noobie but i've come a long way. I've learned a great deal considering my short life in this X Universe,not to much though. To think that i just entered this X universe(the game) just this year..i think it was late august or september. Anyways,i'm very new to this X universe..that's why i sticked with Reunion for the time being. I have a big hunger to learn something in scripting for personal use. Thank you for taking time to answer to all my posts here. The recent script i made is this:
      Quote Originally Posted by auto.repair.selected.ship
      $my.ship= get player tracking aim
      skip if $my.ship->exists
      return null
      while [true]
      $repair.ship.hull=$my.ship->get maximum shield strength
      $my.ship->set current shield strength to $repair.ship.hull
      $repair.ship.hull=$my.ship->get max hull
      $my.ship->set hull to $repair.ship.hull
      $repair.ship.hull=$my.ship->get maximum laser strength
      =wait 500 ms
      end
      This is good if you register it like $key=register hotkey='Repair Hull for Ship' to call script Auto.Repair.Selected.Ship. What this does is when you are in space and select a ship un/damaged,and press the hot key you've selected through "Controls,Interface and then Extensions" ,that particular ship will auto repair itself. I've shooted the ship created many times with full weapons and it doesn't die anymore. Note:I haven't tried shooting that ship with a bigger and well armed ship to see if hull or shield fails. Tested a buster against another.
      Another note: This is also good for auto repair players ship,by deleting or *comment the first 3 lines and replace "$my.ship" with [PLAYERSHIP]. It worked for me.

      EDIT: I've tested the auto.repair.selected.ship while being in Hyperion weapons full and it took quite a while to destroy the tiny Buster. It was funny to see the shield and hull going back up again and again. I guess a bigger ship than M7 Hyperion will destroy Hyperion just as hard as the Hyperion took down the Buster. A Buster will NEVER kill another buster if hotkey is activated. The eclipse will take even more time to destroy the buster. Haven't test that


    8. #8
      TXU's resident chatbox text fiend....... Tritous's Avatar
      Credits
      504.06
      Points
      4,049
      Total Contributions For

      Tritous Points for Shouts      £ 5.00
      Main Info Status and Things Points and Credits Other
      is Dead.
       
      I am:
      Cool
       
      Join Date
      16-03-2006
      Location
      UK, if anywhere
      Posts
      1,164

      Default

      that is not an autorepair script, that is a crude immortality script that every 500ms will completly restore hull and shields.

      An autorepair should:
      - have a slower repair: max of 1% every few seconds
      - consume something
      - have some sort of constraint

      still, it's your game to play as you wish.

      10 PRINT IDLE
      20 GOTO 10

      "Intelligence is like money: when you pass it on to your kids you lose it for yourself"
      -Me, tired

      TXU Wiki:
      Because we are a community
      Thanks Light-in-Heaven, NovaCatt Points for Visitor Messages (Given) thanked for this post

    9. #9
      TXU New Member Light-in-Heaven's Avatar
      Credits
      45.05
      Points
      200
      Total Contributions For

      Light-in-Heaven      £ 0.00
      Main Info Status and Things Points and Credits Other
      is I enjoy the x3R + XTM:)
       
      I am:
      Happy
       
      Join Date
      16-10-2011
      Posts
      32

      Default

      Thank you Tritous for your lovely coments. One has much to learn from you
      Quote Originally Posted by Tritous
      that is not an autorepair script, that is a crude immortality script that every 500ms will completly restore hull and shields.
      I thought that too..was healing the ship to quick..nonetheless,is good rapid emergency
      Quote Originally Posted by Light-in-Heaven View Post
      Arguments: sec.Pos Var/sector position 'Select Sector Position'
      sector =[PLAYERSHIP]get sector
      ****
      $my.ship->get global variable: name= 'buster'
      skip if not $ship == null
      $my.ship=0
      inc $my.ship=
      set global variable: name='buster' value=$my.ship
      $Ships.Final.Name='My Buster - ' + $sector + ' ' + $my.ship
      ****
      A.Pos = sec.Pos
      B.Pos = sec.Pos
      C.Pos = sec.Pos
      sector = sec.Pos

      $my.ship(any ship) = create ship:type= buster owner= Player addto= sector x= A.Pos y= B.Pos z= C.Pos
      $my.ship->set name to $Ships.Final.Name
      return null
      The name ends up as My Buster - Argon Prime 1(and so on). Can you Tritous( since you seem genuinlly to want to help me) tell me a bit more about those "Operations": == ; != ; > ; < ; >= ; <= ; & ; | ; ^ ; AND ; OR ; + ; - ; * ; / ; mod ; ( ; ) ; ~ ; ! . That is if you got the time or you can guide me to a link apropriate to that. Not all of them are unknown to me but i still like to know their full potential. Thank you


    10. #10
      TXU's resident chatbox text fiend....... Tritous's Avatar
      Credits
      504.06
      Points
      4,049
      Total Contributions For

      Tritous Points for Shouts      £ 5.00
      Main Info Status and Things Points and Credits Other
      is Dead.
       
      I am:
      Cool
       
      Join Date
      16-03-2006
      Location
      UK, if anywhere
      Posts
      1,164

      Default

      The scripting logic is based on standard C logic. most of them are binary operators

      == : exactly equals
      != : is not equal
      > : is greater than
      < : is less than
      >= : is greater than / equal to
      <= : is less than /equal to
      AND : logical AND
      OR : logical OR
      + : add / concatenate
      - : subtract
      * : multiply
      / : divide
      ( ) : used to define calculation priority
      mod : modulus (remainder)

      The others I am less certain of. I assume & and | are bitwise and and or but that makes little sense in the x3 data model. ^ I am uncertain of unless it is bit shifting. ~ and ! I assume are NOT operators, and if following C then ! is logical, ~ is bitwise. If you want to know what these mean, take some programming courses. A lot of universities don't keep their notes private, and you'd be surprised how well written some of these are for giving a crash course. Look for computer science 101 style courses and you'll find it helps you start to think like a computer, then you'll find scripting comes naturally

      btw, I assume on your test for the variable being null it is supposed to be $My.ship, not $ship. otherwise it will return true every time and the number will always be 1.





      10 PRINT IDLE
      20 GOTO 10

      "Intelligence is like money: when you pass it on to your kids you lose it for yourself"
      -Me, tired

      TXU Wiki:
      Because we are a community
      Thanks Light-in-Heaven thanked for this post
      Likes Light-in-Heaven liked this post

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •