Author Topic: server scripting  (Read 1751 times)

steuben

  • Veteran
  • *
  • Posts: 1834
    • View Profile
    • Myspace
server scripting
« on: July 16, 2007, 12:49:51 am »
i'm trying to get the sevrer script to work
i know the command at the command line is exec <file name> and at the prompt it is psserver -run=<filename> . but when ever i try it i get the specified file doesn't exsist. it shuold be in the same directory as psserver right?

hmm. it looks like the short answer is yes.. but it only works if i loadmap manually first and then run the script.
« Last Edit: July 16, 2007, 12:58:15 am by steuben »
may laanx frighten the shadow from my path.
hardly because the shadow built the lexx.
the shadow will frighten laanx from my path.

ThomPhoenix

  • Testers
  • Forum Addict
  • *
  • Posts: 2678
  • A Phoenix, what'd you expect?
    • View Profile
Re: server scripting
« Reply #1 on: July 16, 2007, 01:01:46 am »
The server console uses VFS or Virtual File System. You specify the the folder from which the file is running with /this/
So if you have a file named script.txt you would run it with exec /this/script.txt
Inside script.txt you can then put things like:
loadmap npcroom
loadmap hydlaa_plaza
spawn
ready
motd Welcome!

And the server will execute them in that order.
We're not evil. We're simply amazing.

steuben

  • Veteran
  • *
  • Posts: 1834
    • View Profile
    • Myspace
Re: server scripting
« Reply #2 on: July 16, 2007, 01:43:19 am »
so from the server command line i would go
Code: [Select]
exec ./serversciiptfor server script in the same dir as the psserver
?
may laanx frighten the shadow from my path.
hardly because the shadow built the lexx.
the shadow will frighten laanx from my path.

ThomPhoenix

  • Testers
  • Forum Addict
  • *
  • Posts: 2678
  • A Phoenix, what'd you expect?
    • View Profile
Re: server scripting
« Reply #3 on: July 16, 2007, 02:43:46 am »
No, I said that you must use /this/ for the same dir.
exec /this/serverscript.txt
We're not evil. We're simply amazing.

steuben

  • Veteran
  • *
  • Posts: 1834
    • View Profile
    • Myspace
Re: server scripting
« Reply #4 on: July 16, 2007, 05:50:35 pm »
okay. i see. i had read 'this' as meaning foo. i should have noticed that when the server said couldn't load /this/version.dat.
may laanx frighten the shadow from my path.
hardly because the shadow built the lexx.
the shadow will frighten laanx from my path.

Ralleyon

  • Hydlaa Citizen
  • *
  • Posts: 304
  • Protector in the Survivors of Vaern
    • View Profile
Re: server scripting
« Reply #5 on: July 17, 2007, 12:41:40 pm »
I have a script which starts the server... and guess what it's called. server :D

Output of the file:

[Ignore the #!/bin/bash part if you're not on linux. Also, the profile is useless as you have all the environment variables loaded from the start -- Environment Variables in the System Properties]

Code: [Select]
#!/bin/bash

source profile
/opt/planeshift_cvs/planeshift/psserver -run=/this/autorun

The autorun file contains:

Code: [Select]
loadmap npcroom
loadmap npcroom1
loadmap npcroom2
loadmap npcroom_corr
spawn
motd Welcome to the test server
ready

The profile file contains:

Code: [Select]
#!/bin/bash

export LD_LIBRARY_PATH=/opt/planeshift_cvs/planeshift/cal3d/cal3d/src/cal3d/.libs/:$LD_LIBRARY_PATH
export CRYSTAL=/opt/planeshift_cvs/planeshift/cs
export CEL=/opt/planeshift_cvs/planeshift/cel
export CSCONFPATH=/opt/planeshift_cvs/planeshift/cel
export CAL3D=/opt/planeshift_cvs/planeshift/cal3d/cal3d


Aaaand... you'll also need to modify psclient.cfg and psserver.cfg by adding the following (removing the old lines):


Code: [Select]
; ******************
; * Part 3: Game   *
; ******************

Planeshift.Mount.zipmapdir = /this/art/world/
Planeshift.Mount.characterszip = /this/art/characters.zip
Planeshift.Mount.npcszip = /this/art/npcs.zip
Planeshift.Mount.weaponzip = /this/art/things/weapons.zip
Planeshift.Mount.itemzip = /this/art/things/items.zip
Planeshift.Mount.azurezip = /this/art/things/azure_way.zip
Planeshift.Mount.bluezip = /this/art/things/blue_way.zip
Planeshift.Mount.brownzip = /this/art/things/brown_way.zip
Planeshift.Mount.crystalzip = /this/art/things/crystal_way.zip
Planeshift.Mount.darkzip = /this/art/things/dark_way.zip
Planeshift.Mount.redzip = /this/art/things/red_way.zip
Planeshift.Mount.potionszip = /this/art/things/potions.zip
Planeshift.Mount.moneyzip = /this/art/things/money.zip
Planeshift.Mount.bookszip = /this/art/things/books.zip
Planeshift.Mount.shieldszip = /this/art/things/shields.zip
Planeshift.Mount.toolszip = /this/art/things/tools.zip
Planeshift.Mount.naturalreszip = /this/art/things/naturalres.zip
Planeshift.Mount.foodzip = /this/art/things/food.zip
Planeshift.Mount.helmszip = /this/art/things/helms.zip
Planeshift.Mount.jewelryzip = /this/art/things/jewelry.zip

Planeshift.GUI.Skin.Dir = /this/art/skins/
Planeshift.GUI.Skin.Selected = elves

I think the same goes for npcclient.cfg if you plan to start it as well.
« Last Edit: July 17, 2007, 12:44:58 pm by Ralleyon »
To see the world in a grain of sand
And Heaven in a wild flower,
Hold Infinity in the palm of your hand
And Eternity in an hour.
     
   [William Blake - Auguries of Innocence]