Announcement

Collapse
No announcement yet.

Another disapointing Slic attempt

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Martin:

    BTW Peter it wouldn't surprise me if it work,
    Yes, you're right: it works. I generated a NukeCity event in a savegame and nuked my capitol in 5340 BC. He, He.


    Pedrunn:

    Something like: it reads the line 1 first, then line 2, then line 3 ... (I hope you guys understood me)
    Yup, in the olden days programs used to have line numbers (which the programer specified). If they still did we'd be writing stuff like:

    Code:
        600  for(i=0; i< player[0].cities; i=i+1);
        610  GetCityByIndex(player[0], i, tmpCity);
        620  if(CityHasBuilding(tmpCity, "IMPROVE_NUCLEAR_PLANT")) then 640;
        630  goto 690;
        640  randomnum = random(300);
        650  if(randomnum == 0 && !HasAdvance(player[0], ID_ADVANCE_FUSION)) then 670;
        660  goto 690;
        670  Event: NukeCity(tmpCity, player[0]);   
        680  message(tmpplayer, 'NuclearBoom');
        690  next i;
    Someone told me that the line numbers are probably still there but we just can't see them. The above code (which I just made up) shows how the computer would be executing the statements one by one. The curley brackets we use now eliminate the "goto" and "next" statements and make things a lot easier to read.


    Actually when i made a first draft of the code i used tmpcity all the time i just change after i saw the message cod could not figure out what that was. It just know what city[0] means. So i changed this integer name.
    My bad. I was answering your first post where you didn't have the Alertbox. I should have looked more closely at your later posts where you had it in. Yes, you're right, if you're going to have an eyepoint like that you'll need to put "city[0]=tmpCity" in your "NuclearBoom" handler. Here's a couple of other points:

    1) In the Alertbox, you need "Eyepoint(city[0].location); "

    2) If you're going to use an Alertbox (rather than a messagebox) you have to put a button on it.

    Code:
          Button(ID_OK){	
    	    Kill();
    	}
    Alertboxes are described as 'modal', which means it's necessary for the player to respond in order for the game to continue. In order to respond, he's got to have a button to press. Alternately, you might just go for a Messagebox, where the buttons are optional.

    3) I'm not at all sure when "g.player==player[0]" is true. You might have trouble with this, but keep on SLICing.

    Comment


    • #17
      Originally posted by Peter Triggs
      3) I'm not at all sure when "g.player==player[0]" is true. You might have trouble with this, but keep on SLICing.
      I guess that is always true in the BeginTurn Event. So it does not do the thing that I expected.

      Therefore use these two message boxes instead the one with the if condition. So the part of the code would look like this:

      Code:
      if(randomnum == 0	//if randomnum equal to 0 
       && !HasAdvance(player[0], ID_ADVANCE_FUSION)){		// and players doenst have fusion 
      Event: NukeCity(city[0], player[0]);		// a nuclear explosion (nuke).
      message(player[0], 'NuclearBoomUs');			// and a warning message will appear
      MessageAllBut(player[0], 'NuclearBoomThem');
      				}
      So it should be clear what should be in NuclearBoomThem and NuclearBoomUs. BTW Petdrun you should also vistit Locutus' Resitence is futile homepage there you can also find some Slic1 description, that contains some stuff that is not mentioned in the Slic2 documention, the message boxes are one example other interesting examples are AcceptTradeBid() and AcceptTradeOffer(index). Unfortunatly I have no idea if they work, but it is possible as they can be found in the ctp2.exe.

      -Martin
      Civ2 military advisor: "No complaints, Sir!"

      Comment

      Working...
      X