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 > GetInput
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
ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:27
  Old Post 06-04-2003 03:13
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
GetInput Remove this text

Still more SLIC questions ...

Has anyone used GetInput? It's syntax has to be:

Return GetInput;

I assume it allows you to get input from the player somehow, although how this is done with a function return is beyond me. Is that correct? I haven't found a single instance of it used in slc code.

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:27
  Old Post 06-04-2003 05:12
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Avatar Enlargement: We've got the solution

This is a new one on me. Where did you find this?

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:27
Post  Old Post 06-04-2003 19:29 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

GetInput is one of three keyword you can find in Locutus' slic doc and in my Flag list. I classified it as slic function that is probably wrong. It looks rather like something Stop and Continue. Stop is used in slic code the two other keywords aren't used. Possible all the keywords can be used in loops for example. It would be interesting what the use of these words is in other programing languages.

-Martin

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:27
  Old Post 06-04-2003 21:48
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Got spare money?

'Continue' is ok, but you have to use it with 'Return'. There was an example in the Function Reference doc:

code:
int_t i; location_t my_loc; //initialise these variables for(i = 0; i < 8; i = i + 1) { GetNeighbor(city[0].location, i, my_loc); if(AllUnitsCanBeExpelled(my_loc)) { //do stuff return CONTINUE; } } //if all of the enemy units 1 tile away from city[0], do stuff, then break the for loop and continue.


It would be nice if this 'GetInput' returned some mouse value though.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:27
Post  Old Post 06-04-2003 22:16 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Lose 30 kilos (of popups)

That was it I had in mind for continue, but GetInput is still a mystery.

At least we have a possibility to break loops now.

Well we could use it like ahenobarb suggested but then it wouldn't make sense that it returns some mouse values. It could be used as return argument for a function to get to know what it does well at least if it is something with an integer representaion:

[CODE]
int_f TestFunktion(){
return GetInput;
}

-Martin

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:27
  Old Post 06-04-2003 22:57
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

quote:
Originally posted by Peter Triggs
'Continue' is ok, but you have to use it with 'Return'. There was an example in the Function Reference doc:

code:
int_t i; location_t my_loc; //initialise these variables for(i = 0; i < 8; i = i + 1) { GetNeighbor(city[0].location, i, my_loc); if(AllUnitsCanBeExpelled(my_loc)) { //do stuff return CONTINUE; } } //if all of the enemy units 1 tile away from city[0], do stuff, then break the for loop and continue.


It would be nice if this 'GetInput' returned some mouse value though.



Return CONTINUE is also used in Tut_main.slc

code:
//oh, baby, show me your workaround face trigger 'TCheckQueue' on "CityWindow.CloseButton" when (1) { int_t player; player = g.player; if(CityBuildingWonder(player)) { EARLY_BUILDING_STARTED = 1; DisableTrigger('TCheckQueue'); return CONTINUE; } elseif(CityBuildingBuilding(player)) { EARLY_BUILDING_STARTED = 1; DisableTrigger('TCheckQueue'); return CONTINUE; } elseif (AllCitiesBuilding(player)) { Message(g.player, 'TMKeepExploring'); EARLY_BUILDING_STARTED = 1; DisableTrigger('TCheckQueue'); return CONTINUE; } else { return CONTINUE; } }


and in a HandleEvent

code:
//count the number of caravans and let the player know if the have any goods HandleEvent(CreateUnit) 'TCheckForCaravans' post { int_t k; city_t tmpCity; CARAVANS_AVAILABLE = TradePoints(player[0]) - TradePointsInUse(player[0]); if(IsHumanPlayer(player[0]) && CARAVANS_AVAILABLE) { for(k = 0; k < player[0].cities; k = k + 1) { GetCityByIndex(player[0], k, tmpCity); if(CityIsValid(tmpCity)) { if(FindGood(tmpCity.location) >= 0) { city[0] = tmpCity; Message(g.player, 'TMYouHaveAGood'); DisableTrigger('TCheckForCaravans'); return CONTINUE; } else { Message(g.player, 'TMYouHaveNoGoods'); DisableTrigger('TCheckForCaravans'); } } } } }


It seems that this code would function fine without return CONTINUE and it is not clear in this code where CONTINUE is being returned to.

I like Martin's idea about using GetInput in a function. Perhaps, the function could prompt the user to enter something either alphanumeric text (a single key entry or multiple keys?) or mouse clicks, which would then be returned to the statement that called the function. It's not really clear how a mouse click could be returned to the statement. What form would the return be? screen coordinates for the spot that was clicked? 1 or 0?

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:27
Post  Old Post 13-04-2003 00:01 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

Comparing it with Java stuff it looks like continue is used to break a loop cycle in order to continue with the next loop cycle. In all of the examples we see in this thread it wouldn't make any difference if it is there or not. So far I understood it it could replace an if - else statement.

-Martin

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:27
  Old Post 24-04-2003 16:00 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Increase the size of your Attachments

I thought "return CONTINUE" was just the opposite to "return STOP", and - in an event - probably does exactly the same as just "return", or reaching the final closing brace.

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:27.
Apolyton Time is 00:27.
    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.0406 seconds (90.07% PHP - 9.93% 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