Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site forums as they ran on Ultimate Bulletin Board, 1998–2001. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 2005 site & forums

  Apolyton Civilization Site Forums
  CtP2-Creation
  SLIC for beginners

Post New Topic  Post A ReplyPost A Reply In A New Window

profile | register | preferences | faq | search next newest topic | next oldest topic bottom of page
Author
Topic:   SLIC for beginners Format for Better Printing
heardie
GGS Co-Webmaster

Aug 1999
posted January 06, 2001 19:28   Click Here to See the Profile for heardieClick Here to Email heardie  send a private message to heardieSend a Message to UIN: 55652350 Visit heardie's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Some quick notes I made after my first day with SLIC(preying that it will format correctily ):

Beginners intro to SLIC

With my first SLIC code done, I went into CTP, and what did I see? Nothing. So here I present to you
“How to get your code to work”
For this I will describe two things.
1. Events that only appear at the start.
2. Events that appear every turn.

1. To get an event to appear only once is simple once you know how. Here it is.
First create your ‘handle’ (Just a name for each bit of code)

code:

HandleEvent(EventName) 'HandlerName' [pre | post]
{
// Your code here
}


The priority of the handler can be either pre or post. A "pre" handler runs before the in-game code, a "post" handler runs afterwards.

Now I will explain how to get a message box with your name in it to appear!
Where I have written ‘//Your code here’ replace with

code:

Message (g.player, 'Name');


where name, is an variable name you please.
Now for sanity’s sake (since in large scenarios there are hundreds of messages) you can put your message descriptions in another SLIC file.
Call it ‘msg.slc’
To use this file in your program, on the very last line of your scenario.slc write
code:

#include “msg.slc”;


Now how do we define what we say in our message?
Well this describes a basic message box, that only has an exit button.
First you open up your ‘msg.slc’
Then type in the following
code:

messagebox 'Name'
{
Show();
Title(ID_TITLE);
Text(ID_TEXT);
Button(ID_EXIT)
{
Kill();
}
}


Don’t worry if this looks confusing at first I will explain. In the first line, replace ‘name’ with the name you used in ‘scenario.slc’. The first line is telling the game this is that particulare message box.

The 3rd line says Show (). This should be self-explanatory; you don’t want a hidden message box. The next line is a bit more confusing. It the title of the message box, and the title will be in the string Title. Where is this string held?
Look in your scen000 dir. Then create a new directory called english, and then a new directory in that called gamedata. Then create a text file called scen_str. That is where the string Title is held. Open it up.
Type like this

code:

TITLE "Title of your message box here"
TEXT "Text of your message box here”


Now you should understand up to line 6 in the code.
Lines 7-10 are easy to expain:
Button(ID_EXIT), is like title and text. In your scen_str file you should write
code:

EXIT “Exit”


Line 9 means, that when you click on that button the message box disappears. Simple, huh? Now since this is the messagebox we only want to appear on the first turn we do this next
code:

DisableTrigger('HandlerName');


This means that from now on this will not run.
Next we want a message box that appears each turn and shows you the turn no.
Here is how:
code:

HandleEvent(EventName) 'Name' [pre | post]


Create another handle.
Then we create the message box:
code:

Message (g.player, ‘msgtype’);


Then we edit the ‘msg.slc’ file to make the msg appear
code:

messagebox 'EveryTurn' {
Show();
Title(ID_DROUGHT_TITLE);
Text(ID_DROUGHT_TEXT);
Button(ID_EXIT)
{
Kill();
}
}


Also update scen_str
code:

DROUGHT_TITLE "Turn #
DROUGHT_TEXT "Turn {g.year}"


All that is new here is g.year, which accesses what year it is up to in the game. Now since we want it every turn we don’t do DisableTrigger. That is it.

Appendix A.
Here are my completed files with there variable names

scenario.slc

code:

/////////////////////////
// Do At the beginning //
/////////////////////////

HandleEvent(BeginTurn) 'DStart_F' pre
{
Message (g.player, 'AGStartA');
DisableTrigger('DStart_F');
}


//////////////////////////
// Do Every Turn //
//////////////////////////

HandleEvent(BeginTurn) 'D_EveryTurn' pre
{
Message (g.player, 'EveryTurn');
}
#include "msg.slc"



msg.slc
code:

messagebox 'AGStartA' {
Show();
Title(ID_AG_START_TITLE);
Text(ID_AG_START_A);
Button(ID_EXIT)
{
Kill();
}
}

messagebox 'EveryTurn' {
Show();
Title(ID_DROUGHT_TITLE);
Text(ID_DROUGHT_TEXT);
Button(ID_EXIT)
{
Kill();
}
}



scen_str.txt
code:

EXIT "Exit"
AG_START_TITLE "Natural Disasters"
AG_START_A "Made by heardie"
DROUGHT_TITLE "Drought strikes your Civ!"
DROUGHT_TEXT "Year {g.year}"


MrFun
Warlord
United States, Iowa
Nov 2000
posted January 07, 2001 14:01   Click Here to See the Profile for MrFun   send a private message to MrFun Visit MrFun's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
I have bookmarked this post for future reference. Thanks for the info.
Apolyton Civilization Site Forums
> > > CtP2-Creation Forum

next newest topic | next oldest topictop of page

All times are EDT

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A ReplyPost A Reply In A New Window
Hop to:

Contact Us
Apolyton Civilization Site

Powered by: Ultimate Bulletin Board, Version 5.44a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.

Front Page | Civilization III | Dinosaurs | Civilization II | Call to Power | Call to Power II | Alpha Centauri | Alternative Civs | Misc | Links | About ACS | GameStats
GameLeague | Scenario League | HAC | Civilization Scenario Collection | Spanish CivII Site | Clash of Civs | CtP Maps | Art of War | WesW's Ctp1/2 Site