February 1, 2003, 20:15
|
#1
|
Prince
Local Time: 16:33
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Knee-Deep in SLIC
I have a question.
Whilst testing out some of the deeper workings of the BattleAftermath event (damn I'm cool), I messaged myself all the values that the event called.
The following results were from a battle where the attacking army lost.
So for BattleAftermath, we have from the docu:
Code:
|
BattleAftermath(army_t, location_t, unit_t, unit_t, int_t, int_t, int_t) |
So not having a string for army, I passed in the army[0].size in, and unit[0].type and unit[1].type, the location as {.x},{.y} and the player numbers.
The attached picture is the result.
army[0].size = 97970400 ?? erm... hows that then?
location coords are correct.
units: 1st one is a mystery even to the game apparently, but it brings up a message I've never seen before... (would this be the type of the unit in the attacking army that got wiped out?)
2nd one comes out as 87 (which was the .type of one of the defenders)
player[0] comes out fine - me
player[1] doesn't work at all
and the int at the end is 1. Maybe this means "attackers lost" and 0 is "attackers won"
But the army size thing is a mystery...
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
|
|
|
|
February 2, 2003, 02:29
|
#2
|
King
Local Time: 12:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Re: Knee-Deep in SLIC
Quote:
|
Originally posted by Immortal Wombat
But the army size thing is a mystery...
|
I have seen this bug with other event. I have tested the ArmyClicked(army_t).
As i figured out you cant know the size of another civ unit in string form.
In my testing with the army[0].size revealed in a message. If you own the unit it gives the correct number but if the owner is another cive big crazy numbers show up like the one you got.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Last edited by Pedrunn; February 2, 2003 at 10:57.
|
|
|
|
February 2, 2003, 10:40
|
#3
|
Super Moderator
Local Time: 17:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Ben could you give us the exact string that you used in the message box I think you forgot something concerning player[1].
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
February 2, 2003, 11:03
|
#4
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
|
Weird stuff. I tried:
Code:
|
int_t armysize;
int_t armyowner;
HandleEvent(BattleAftermath) 'BattleAftermathTestpre' pre {
setstring(0,ID_pre);
armysize=army[0].size;
armyowner=army[0].owner;
message(1,'BattleAftermathTestM');
}
HandleEvent(BattleAftermath) 'BattleAftermathTestpost' post {
setstring(0,ID_post);
armysize=army[0].size;
armyowner=army[0].owner;
message(1,'BattleAftermathTestM');
}
messagebox 'BattleAftermathTestM' {
show();
Text (ID_BattleAftermathTestTxt );
} |
with strings:
Code:
|
BattleAftermathTestTxt "{action[0].text}: armysize=
{armysize}, armyowner={armyowner}, 0={player[0].civ_name_plural},
1={player[1].civ_name_plural},
\n unit0={unit[0].type}, unit1={unit[1].type}"
pre "pre"
post "post" |
The resulting data is the same whether reported pre or post and just depends on who won the battle.
army[0] is the attacking army: if it loses the battle, it ceases to exist. It looks like unit[0] is some attacking unit and unit[1] is some defending unit. Depending on who won the battle, one of these will be the invalid unit and we get that strange error message.
|
|
|
|
February 2, 2003, 14:43
|
#5
|
Prince
Local Time: 16:33
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Quote:
|
Originally posted by Martin Gühmann
Ben could you give us the exact string that you used in the message box I think you forgot something concerning player[1].
|
Oh yeah, looks like I screwed up the opening brace { I can't give you the exact string, I removed it when I used the tester message for something else.
What I wondered was whether since army[0] does not exist (a pain in the arse btw), army[0].size returns the address of the army size?
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
|
|
|
|
February 2, 2003, 16:47
|
#6
|
Emperor
Local Time: 01:33
Local Date: November 2, 2010
Join Date: Dec 2000
Posts: 3,944
|
That large number could be the memory address location of the army. A lot of programmers use this shortcut so they don't need to pass the entire class data into new functions, as it causes multiple copies to be in memory.
|
|
|
|
February 5, 2003, 05:43
|
#7
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
why where you testing this out is there a mod on its way.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
February 5, 2003, 13:16
|
#8
|
Super Moderator
Local Time: 17:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by The Big Mc
why where you testing this out is there a mod on its way.
|
I don't know if Ben used it for a new mod possible it is some LOTR stuff or something else. The main information of this thread is how you can test event handlers check the values of the build in variables that are usefull for debugging and that you should extract information from invalid objects. Yeah this will give you sometimes DebugSlic=Yes errors.
So testing this stuff has the purpose of getting information and to satify our curiousity. To get ideas for new stuff.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
February 5, 2003, 14:37
|
#9
|
Prince
Local Time: 16:33
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Battle tracking in the LOTR scenario.
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
|
|
|
|
February 6, 2003, 07:02
|
#10
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
I would like to see it when it is done
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
February 6, 2003, 08:52
|
#11
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: May 1999
Posts: 1,528
|
Out of curiousity, do we know for a fact that *this*
Quote:
|
Quote by MrOgre
Important note! As this documenation is being prepared, the first patch for CTP2 is about to be released. Unfortunately a bug with functions was discovered too late to fix. Specifically, in some cases, using members of unit, army, city, and location variables that are function parameters may not always work as expected. There is, however, a workaround. Copy the function parameter to a local variable and use that variable instead.
|
was fixed, in every case?
|
|
|
|
February 6, 2003, 09:08
|
#12
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
Could be a lazy activsion thing. But you have a cat in hells chance of getting anything out of the puddle of eternal wisdom(activsion) I remember the war which was designated as a partial victory as the activsion staff got very offensive and would not talk to me.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
February 6, 2003, 09:13
|
#13
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: May 1999
Posts: 1,528
|
ahh... I'm not saying that there is any chance of knowing for sure... or getting it fixed if it is... but just maybe its a good idea to copy non int arguments to a local var, just in case... so that we don't get unforseen bugs?
|
|
|
|
February 6, 2003, 09:32
|
#14
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
We could try that.
I would love to know what enemies I am attacking for my hero unit.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
February 6, 2003, 09:42
|
#15
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: May 1999
Posts: 1,528
|
I still think you'll have the problem of a non-existent (due to the fact that the designers delete the army/unit after it ceases to exist) defeated army...
The best way of dealing with this is knowing what is being attacked before the battle happens....
using, for instance...
Battle(army_t, location_t)
An army attacks a location
|
|
|
|
February 6, 2003, 10:01
|
#16
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
yes that code could work
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
February 6, 2003, 11:48
|
#17
|
Prince
Local Time: 16:33
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Quote:
|
Originally posted by The Big Mc
I would like to see it when it is done
|
Patience, little grasshopper
I should be done this month unless any bugs show up in testing that passed me by so far.
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
|
|
|
|
February 6, 2003, 11:55
|
#18
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
hoow wise master I have travelled many nights to try to find a slicer with my skill could you point me in the direction of a master slicer.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
February 6, 2003, 14:46
|
#19
|
Super Moderator
Local Time: 17:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by MrBaggins
Out of curiousity, do we know for a fact that *this*
Quote:
|
Quote by MrOgre
Important note! As this documenation is being prepared, the first patch for CTP2 is about to be released. Unfortunately a bug with functions was discovered too late to fix. Specifically, in some cases, using members of unit, army, city, and location variables that are function parameters may not always work as expected. There is, however, a workaround. Copy the function parameter to a local variable and use that variable instead.
|
was fixed, in every case?
|
In that case I would recomment to read the small sentence under the code:
Quote:
|
The author apologizes for this and promises that if there is another patch it will be fixed. But the above workaround should always work.
|
Most important here is the little word: if. They promissed to fix it if there will be another patch but as we all know there was no more patch therefore this bug isn't fixed.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
February 6, 2003, 15:01
|
#20
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: May 1999
Posts: 1,528
|
weren't there two patches?
1.1
and
1.11
Anyway... I guess its wise to be wary of the warning, and copy these non-ints locally, when you use them.
|
|
|
|
February 6, 2003, 15:28
|
#21
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
tipical for activsion.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
February 6, 2003, 16:00
|
#22
|
Super Moderator
Local Time: 17:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by MrBaggins
weren't there two patches?
1.1
and
1.11
Anyway... I guess its wise to be wary of the warning, and copy these non-ints locally, when you use them.
|
No there is just one patch v1.1 and v.1.11 are idential the only different is the installer. The installer of v.1.1 had some problems on non US/UK English OS versions IIRC. So the content is the same.
To the promisse again they said if and not when, so it was at this time already questionable if there would be another patch.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
February 6, 2003, 16:09
|
#23
|
Super Moderator
Local Time: 17:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Wired I should be the last person posted in this thread, but obviously the post wasn't registrated.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
February 7, 2003, 13:56
|
#24
|
Super Moderator
Local Time: 17:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Well I just tried this and good a lot of sytax errors:
Code:
|
HandleEvent(SendGood)'MG_GiveGoodASound'post{
message(1,'MGGoodMessage');
}
MessageBox'MGGoodMessage'{
Text(ID_MG_GOOD_MESSAGE);
}
MG_GOOD_MESSAGE "Ressurce hat: {ressourceDB(value[0])}, {ressourceDB(value[0]).Sound}, {ressourceDB(value[0]).SpriteID}, {ressourceDB(value[0]).Gold}, {ressourceDB(value[0]).Food}, {ressourceDB(value[0]).Production}, {ressourceDB(value[0]).Probability}" |
The errors were like this:
arguments not implemented
Function calls not implemented
Well I belive this as most of the fields in the Good.txt don't do anything. But this means the RessourceDB function is useless.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
February 7, 2003, 14:02
|
#25
|
Super Moderator
Local Time: 17:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
And again a not registered post.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
February 10, 2003, 06:11
|
#26
|
Prince
Local Time: 16:33
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
I think it just means you can't call functions from the string files. You need to assign it to a global in the SLIC, and then pass that to the message box.
ResourceDB() is an int_f function that returns a number given a string, so it can't be used in the string files.
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
|
|
|
|
February 10, 2003, 13:27
|
#27
|
King
Local Time: 15:33
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
|
I had a problem at the week end to I put in some slic for my science victory and got an error. I tried to pass a player into a variable and then use that variable to find out the number of cities the player had.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
|
|
|
|
Posting 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
|
|
|
All times are GMT -4. The time now is 11:33.
|
|