Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > SLIC for beginners
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
heardie is offline heardie
Prince

Aug 1999
time: 15:14
Post  Old Post 07-01-2001 05:28
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
SLIC for beginners Tired of ads?

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 is offline MrFun
King
of Iowa
Nov 2000
time: 23:14
Post  Old Post 08-01-2001 00:01 Visit MrFun's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Increase Your PM Length

I have bookmarked this post for future reference. Thanks for the info.

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:14.
Apolyton Time is 00:14.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0350 seconds (86.33% PHP - 13.67% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net