Page 1 of 1

How to code a .txt ?

Posted: Wed Dec 19, 2012 3:03 pm
by Gibbs3333
Hi guys ! I am a french map maker and I have a problem with the .txt for the maps. I can't install map extensions as water damage, nobuild and I don't know why... I tried to regroup codes and then when I want to connect my server...bug. Can you help me ?
PS: I replace numbers to X,Y.

Image

Re: How to code a .txt ?

Posted: Wed Dec 19, 2012 3:29 pm
by HoboHob
First off open Notepad, select the script, and press CTRL + X on your keyboard.

Go to your new Notepad window and press CTRL + V.

Now you have the script and map separate.

Then save the script in the scripts folder of PySnip (dist\scripts) as a .py file, not a .txt. Scripts must be in .py form.

Next put a quotation mark in front of the description behind the parentheses :) . Then save your map text file and place it with your map in the maps folder (dist\maps). Open up config.cfg (I think that is what it is called). It is in JSON format, search for scripts. In the scripts box put in the name of the script you just saved. Search for maps and erase everything but the name of the map you just saved.

And you're done!

Re: How to code a .txt ?

Posted: Wed Dec 19, 2012 4:16 pm
by Gibbs3333
Thank you to help me quickly. It 's interesting but if I create this new script, the properties for the intel, flag & base will be for all the maps ? When I wrote a .txt with just the part #scripting, it was okay but I want all in one .txt. Is it possible or must I create two separate .txt ?

Re: How to code a .txt ?

Posted: Wed Dec 19, 2012 4:28 pm
by HoboHob
Gibbs3333 wrote:
Thank you to help me quickly. It 's interesting but if I create this new script, the properties for the intel, flag & base will be for all the maps ? When I wrote a .txt with just the part #scripting, it was okay but I want all in one .txt. Is it possible or must I create two separate .txt ?
Yes the script will be available on all maps.

I don't think it is possible though, to have the script enabled for only one map.

Re: How to code a .txt ?

Posted: Wed Dec 19, 2012 5:23 pm
by Gibbs3333
Thank you for your advice, I found where was the problem and we can write all in one .txt ! I show you an example Blue_Happy3 :
Code: Select all
name = 'DesertTown'
version = '1.0'
author = 'Gibbs3333'
description = ('Gibbs3333')
protected = ['D4','D5']
extensions = {
         'water_damage' : 100
}
# scripting

from pyspades.constants import *
from pyspades.server import ServerConnection

def get_entity_location(team, entity_id):
    if entity_id == BLUE_FLAG:
        return (297, 279, 59)
      
    if entity_id == BLUE_BASE:
        return (297, 279, 59)
      
    if entity_id == GREEN_FLAG:
        return (214, 231, 59)

    if entity_id == GREEN_BASE:
        return (214, 231, 59)

def get_spawn_location(connection):
 
    if connection.team is connection.protocol.blue_team:
        # sets a static spawn for just the blue team, but you could use "green_team" too.
        return (297, 279, 59)

    if connection.team is connection.protocol.green_team:
        # sets a static spawn for just the green team, but you could use "blue_team" too.
        return (214, 231, 59)