PlaneShift

Development => Development Deliberation => Topic started by: steuben on July 16, 2007, 12:49:51 am

Title: server scripting
Post by: steuben 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.
Title: Re: server scripting
Post by: ThomPhoenix 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.
Title: Re: server scripting
Post by: steuben 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
?
Title: Re: server scripting
Post by: ThomPhoenix on July 16, 2007, 02:43:46 am
No, I said that you must use /this/ for the same dir.
exec /this/serverscript.txt
Title: Re: server scripting
Post by: steuben 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.
Title: Re: server scripting
Post by: Ralleyon 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.