days in game
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
days in game
Is there any way to discern between days in the game and have certain usecode functions called on that day? for example:
-the F2 Menu displays "Day 0"
-the F2 Menu displays "Day 2"
- if "day 2", npc does this.
-the F2 Menu displays "Day 3"
-if "day 3", npc does this.
i've been working with timers successfully with usecode eggs, however i've come into a problem. I have the timer start by a usecode egg when you get within 5 tiles, and the egg disappears. when that timer passes a certain time, it starts another timer and so on, until the last timer runs out, the original timer starts again. The problem is, that if you save and restart Exult, it seems the timer is no longer running. if your timer relies on being started by an egg which only appears once (to keep continuity), the other timers won't start. So, how do I work around this? - keeping the timers going when they are supposed to. If there was some way I could check which day it actually is and have usecode functions work depending on which day it is, how do I do that?
If I need to clarify anything let me know, I've looked everywhere and I havent' found anything which answers my questions..
-the F2 Menu displays "Day 0"
-the F2 Menu displays "Day 2"
- if "day 2", npc does this.
-the F2 Menu displays "Day 3"
-if "day 3", npc does this.
i've been working with timers successfully with usecode eggs, however i've come into a problem. I have the timer start by a usecode egg when you get within 5 tiles, and the egg disappears. when that timer passes a certain time, it starts another timer and so on, until the last timer runs out, the original timer starts again. The problem is, that if you save and restart Exult, it seems the timer is no longer running. if your timer relies on being started by an egg which only appears once (to keep continuity), the other timers won't start. So, how do I work around this? - keeping the timers going when they are supposed to. If there was some way I could check which day it actually is and have usecode functions work depending on which day it is, how do I do that?
If I need to clarify anything let me know, I've looked everywhere and I havent' found anything which answers my questions..
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Usecode timers should survive save/reset in certain cases, however, Exult does not implement that directly. You can save attributes to the Avatar, however, quite arbitrarialy; you can also declare script globals, which is how TFL retains the karma information for the avatar.
You cannot currently retrieve the day # intrinsically; only the current game hour and minute ( UI_game_hour and UI_game_minute )
The way to do this non-intrinsically would be to make a global when the game starts (as part of the intro cutscene usecode, or a little more hacky way to do it would be a proximity or step-on trigger convinently placed in the Avatar's path) - and then keep track of the days, updating that global when the day would change (UI_game_hour = 11 UI_game_minute=58) seems to be when, Ive noticed)
The alluded to example of the Karma system retaining variables is in this repository file, specifically the KarmaManager class: http://u7feudallands.cvs.sourceforge.ne ... iew=markup
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
You cannot currently retrieve the day # intrinsically; only the current game hour and minute ( UI_game_hour and UI_game_minute )
The way to do this non-intrinsically would be to make a global when the game starts (as part of the intro cutscene usecode, or a little more hacky way to do it would be a proximity or step-on trigger convinently placed in the Avatar's path) - and then keep track of the days, updating that global when the day would change (UI_game_hour = 11 UI_game_minute=58) seems to be when, Ive noticed)
The alluded to example of the Karma system retaining variables is in this repository file, specifically the KarmaManager class: http://u7feudallands.cvs.sourceforge.ne ... iew=markup
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Ok I've tried to experiment with this a little but haven't got too far on it. When you say "save attributes to the Avatar" i assume you mean by making the Avatar a usecode file such as Avatar.uc like you would a normal npc right? I tried that but nothign seems to work that way so I'm probably doing it totally wrong. I made this to experiment with it, it compiles but it doesn't seem to work:
Code: Select all
void Avatar object# (0x400) ()
{
var hour;
var minute;
hour = UI_game_hour();
minute = UI_game_minute();
//START_OF_GAME = 1102
if (gflags[START_OF_GAME] == true)
{
if ((hour == 23) && (minute >= 58))
{
gflags[DAY_ONE] = true;
gflags[START_OF_GAME] = false;
randomPartyBark("@this works.@");
}
}
}
//if (event == PROXIMITY)//compiles, but doesn't work?
// {
//
// if (gflags[START_OF_GAME])
// {
// if ((hour == 23) && (minute >= 58))
// {
// gflags[DAY_ONE] = true;
// gflags[START_OF_GAME] = false;
// randomPartyBark("@this works.@");
// }
//
//
// }
//
// }
}
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
crap i posted that accidentally while i was trying to edit it (sorry! ). I tried both of those methods, and none seemed to work.
i took a look at the link, i might have to borrow that eventually for the karma system in u6 if that is ok I didn't see what to use for the days though, and i can't think of how to do the script globals. Can you show me a specific example? I could probably figure it out then, i can do quite a bit with this stuff but i'm not really proficient with it by any means.
i took a look at the link, i might have to borrow that eventually for the karma system in u6 if that is ok I didn't see what to use for the days though, and i can't think of how to do the script globals. Can you show me a specific example? I could probably figure it out then, i can do quite a bit with this stuff but i'm not really proficient with it by any means.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Youre free to fild spindle and mutilate it as long as you follow GPL terms. Personally, I am quite happy that someone else would find use for it. Im posting from my mobile right now but when I get home I will try to provide a better explanation and examples of what I mean.
--------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
--------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
I did this off the top of my head, it compiles just fine, but I'm not sure if I got it to where it actually does anything. I tried testing it with a usecode egg but when I try to use "gameDay()" it gives an error message. I'll provide an example of the egg I made too:
It copied really funky but I had it all neat in the actual code. here is the egg I made:
What am I doing wrong with these? I can't seem to figure it out. if it worked correctly, it -should- bark when the day switches in the code right? I just wanted some kind of verification while testing it that it actually works.
Code: Select all
var gameDay (var current_day)//should get the current day if used?
{
var modifiedAddition;
var game_start;
var addDayOne;
var addDayTwo;
var addDayThree;
var addDayFour;
var addDayFive;
var addDaySix;
var day_tally;
var minusSix;
var game_current;
var hour;
var minute;
game_start = 0;
addDayOne = 1;
addDayTwo = 1;
addDayThree = 1;
addDayFour = 1;
addDayFive = 1;
addDaySix = 1;
minusSix = 6; //should cycle back to day 0?
minute = UI_game_minute();
hour = UI_game_hour();
current_day = (game_current);
if (current_day == 0)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 1.@");
game_current = (game_start + addDayOne);
}
}
else
if (current_day == 1)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 2.@");
game_current = (game_current + addDayTwo);
}
}
else
if (current_day == 2)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayThree);
randomPartyBark("@Day 3.@");
}
}
else
if (current_day == 3)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else
if (current_day == 4)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 5.@");
game_current = (game_current + addDayFive);
}
}
else
if (current_day == 5)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 6.@");
game_current = (game_current + addDaySix);
}
}
else
if (current_day == 6)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 0.@");
game_current = (game_current - minusSix);
}
}
}
Code: Select all
void Testegg 0xD09()
{
if (event == EGG)
{
var game_day;
game_day = gameDay();
if (game_day) == 1)
{
randomPartyBark("@Day 1@");
}
else if (game_day == 2)
{
randomPartyBark("@Day 2@");
}
else if (game_day == 3)
{
randomPartyBark("@Day 3@");
}
}
}
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
You can store and retrieve variables on NPCs and the PC with set_npc_prop() and get_npc_prop() respectively. It is worth noting that I believe these are Exult-specific intrinsics. The upshoot to this approach is that these variables become viewable on the ZTATS (z) panel.
An example of using NPC props is in version 1.0 of the karma system: http://u7feudallands.cvs.sourceforge.ne ... iew=markup
I later decided I didnt want the karma stats viewable so I went to the second approach, which is to make the variables global. The best way to do this is to create an object class (such as Marzo and I did with the KarmaManager object) which has the properties you want to manipulate, for example, a "Time" class with minute/hour/day/week/month/etc
As to why your code isnt working as you intend it to - the variables are not being made global, and will only survive the execution of their current scope. Which is to say that they are being retained while a single instance of that function is running.
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
An example of using NPC props is in version 1.0 of the karma system: http://u7feudallands.cvs.sourceforge.ne ... iew=markup
I later decided I didnt want the karma stats viewable so I went to the second approach, which is to make the variables global. The best way to do this is to create an object class (such as Marzo and I did with the KarmaManager object) which has the properties you want to manipulate, for example, a "Time" class with minute/hour/day/week/month/etc
As to why your code isnt working as you intend it to - the variables are not being made global, and will only survive the execution of their current scope. Which is to say that they are being retained while a single instance of that function is running.
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
How would I make the code I did global? I couldn't figure out how to do that.
I didn't seem to have much luck making the class either.
I didn't seem to have much luck making the class either.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Remember that if you make a class in the script, you need to initialise it for it to be useful.
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
I have no idea still. Is the script I made useful for this? Originally i tried to make it a class but I think I'm doing somethign totally wrong. I've tried everything i can think of.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Ok i actually started over and got it to work now via scripts. It seems to function just fine as i wanted it to. by the way, is there any limit on to how long a script can be initialized after so many ticks? currently i'm still testing it, but i'm hoping to have a 6 day cycle that resets after the 6th day since a few npcs in u6 seemed to change their schedules every other day in a cycle.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Thanks for all your help man. Right now i'm playing around with scripts and I notice that scripts are treated as if you have the "etheral" flag on. This creates a problem when you try to script the Avatar to lay on a bed. for example, I have a horizontal bed and in the script, the avatar walks up to it, kneels, then lays down horizontally facing east. THe problem is, that the bed "swallows" the avatar because the avatar's z-coords is 0 instead of 1 which it should be. I've tried messing with this by creating an egg which teleports the avatar to the starting position with the z coords of 1, but once it starts walking, he "falls" back to z coord 0. Is there an easy work around to this?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
I've never experienced that bug before, but I can experiment and see if I can reproduce it and find a workaround.
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
Also, the avatar will walk straight through doors as if he was etheral. Is that intended or a bug?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
And the Avatar is not, I presume, set with the ethereal flag? Nothing else should cause behaviour like that.
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Site Admin
- Posts: 985
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
You should look at UI_path_run_usecode and the next couple functions I think they will move people properly through doors. If I remember properly, the UCC script ignores obstacles with step, rise, and descend. The rise command can move the Avatar to the proper height.
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
If you use path_run_usecode, its worth mentioning that no code will execute on failure to run the path unless you use UI_set_path_failure to specify a function to run in the failure case.
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
The etheral flag was turned off, so I don't know why it does that.
when you use UI path run usecode, do those use the red "path" numbers? or the actual path eggs?
when you use UI path run usecode, do those use the red "path" numbers? or the actual path eggs?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
-
- Site Admin
- Posts: 985
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
It goes to a location if it can walk there (SI one is more lenient). It doesn't use physical markers unless you specifically tell it to use them like with find nearby.
-
- Posts: 1241
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
It should be entirely possible to have normal usecode (let alone UCC) functions steer the avatar normally without pathfinding. This much is evident in the Frigidazzi scene. I believe, however, that some of the functionality used in that scene was SI specific.
-----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
-----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Re: days in game
Random off topic question. Do you have to write the code that way? Cant it be one or two lines? I know it may seem easier to troubleshoot all expanded like that...
Re: days in game
It's common standard to write code like that. If you put it all in fewer lines ut is much harder to troubleshoot. Especially as compilers and debuggers give you a line number when things break.
Icouldhavewrittenallthisinthiswaywithoutspacesbetweenwordsbutitismucheasierifisticktoconventions.whenyouwanttopointoutanerrorinmywritingit'smucheasierwithspaces...
Icouldhavewrittenallthisinthiswaywithoutspacesbetweenwordsbutitismucheasierifisticktoconventions.whenyouwanttopointoutanerrorinmywritingit'smucheasierwithspaces...
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
-
- Site Admin
- Posts: 985
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
The code is a lot better to read like this. (The tab spacing in the forum is horrible though.)
Example 1
or this
Example 2
or this
Example 3
or this (I personally don't care for this style)
Example 4
Example 1
Code: Select all
if (current_day == 0) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 1.@");
game_current = (game_start + addDayOne);
}
} else if (current_day == 1) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 2.@");
game_current = (game_current + addDayTwo);
}
} else if (current_day == 2) {
if ((hour == 23) && (minute >= 58)) {
game_current = (game_current + addDayThree);
randomPartyBark("@Day 3.@");
}
} else if (current_day == 3) {
if ((hour == 23) && (minute >= 58)) {
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
} else if (current_day == 4) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 5.@");
game_current = (game_current + addDayFive);
}
} else if (current_day == 5) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 6.@");
game_current = (game_current + addDaySix);
}
} else if (current_day == 6) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 0.@");
game_current = (game_current - minusSix);
}
}
}
or this
Example 2
Code: Select all
if (current_day == 0) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 1.@");
game_current = (game_start + addDayOne);
}
}
else if (current_day == 1) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 2.@");
game_current = (game_current + addDayTwo);
}
}
else if (current_day == 2) {
if ((hour == 23) && (minute >= 58)) {
game_current = (game_current + addDayThree);
randomPartyBark("@Day 3.@");
}
}
else if (current_day == 3) {
if ((hour == 23) && (minute >= 58)) {
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else if (current_day == 4) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 5.@");
game_current = (game_current + addDayFive);
}
}
else if (current_day == 5) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 6.@");
game_current = (game_current + addDaySix);
}
}
else if (current_day == 6) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 0.@");
game_current = (game_current - minusSix);
}
}
}
or this
Example 3
Code: Select all
if (current_day == 0)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 1.@");
game_current = (game_start + addDayOne);
}
}
else if (current_day == 1)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 2.@");
game_current = (game_current + addDayTwo);
}
}
else if (current_day == 2)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayThree);
randomPartyBark("@Day 3.@");
}
}
else if (current_day == 3)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else if (current_day == 4)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 5.@");
game_current = (game_current + addDayFive);
}
}
else if (current_day == 5)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 6.@");
game_current = (game_current + addDaySix);
}
}
else if (current_day == 6)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 0.@");
game_current = (game_current - minusSix);
}
}
}
or this (I personally don't care for this style)
Example 4
Code: Select all
if (current_day == 0)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 1.@");
game_current = (game_start + addDayOne);
}
}
else if (current_day == 1)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 2.@");
game_current = (game_current + addDayTwo);
}
}
else if (current_day == 2)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayThree);
randomPartyBark("@Day 3.@");
}
}
else if (current_day == 3)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else if (current_day == 4)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 5.@");
game_current = (game_current + addDayFive);
}
}
else if (current_day == 5)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 6.@");
game_current = (game_current + addDaySix);
}
}
else if (current_day == 6)
{
if ((hour == 23) && (minute >= 58))
{
randomPartyBark("@Day 0.@");
game_current = (game_current - minusSix);
}
}
}
-
- Site Admin
- Posts: 985
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
The one major difference between the first two is how they collapse in Notepad++.
Example 1 collapses every else statement with the first if and it will look like this:
The Example 2 only collapses the first if block and it will look like this:
You could then collapse each individual else (second example)
or any combination (Example 2)
Examples 3 and 4 collapse similar to Example 2
Example 3
Example 4
Example 1 collapses every else statement with the first if and it will look like this:
Code: Select all
if (current_day == 0) {
}
The Example 2 only collapses the first if block and it will look like this:
Code: Select all
if (current_day == 0) {
else if (current_day == 1) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 2.@");
game_current = (game_current + addDayTwo);
}
}
else if (current_day == 2) {
if ((hour == 23) && (minute >= 58)) {
game_current = (game_current + addDayThree);
randomPartyBark("@Day 3.@");
}
}
else if (current_day == 3) {
if ((hour == 23) && (minute >= 58)) {
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else if (current_day == 4) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 5.@");
game_current = (game_current + addDayFive);
}
}
else if (current_day == 5) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 6.@");
game_current = (game_current + addDaySix);
}
}
else if (current_day == 6) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 0.@");
game_current = (game_current - minusSix);
}
}
}
Code: Select all
if (current_day == 0) {
else if (current_day == 1) {
else if (current_day == 2) {
else if (current_day == 3) {
else if (current_day == 4) {
else if (current_day == 5) {
else if (current_day == 6) {
Code: Select all
if (current_day == 0) {
if ((hour == 23) && (minute >= 58)) {
randomPartyBark("@Day 1.@");
game_current = (game_start + addDayOne);
}
}
else if (current_day == 1) {
else if (current_day == 2) {
else if (current_day == 3) {
if ((hour == 23) && (minute >= 58)) {
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else if (current_day == 4) {
else if (current_day == 5) {
else if (current_day == 6) {
Examples 3 and 4 collapse similar to Example 2
Example 3
Code: Select all
if (current_day == 0)
{
else if (current_day == 1)
{
else if (current_day == 2)
{
else if (current_day == 3)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else if (current_day == 4)
{
else if (current_day == 5)
{
else if (current_day == 6)
{
}
Code: Select all
if (current_day == 0)
{
else if (current_day == 1)
{
else if (current_day == 2)
{
else if (current_day == 3)
{
if ((hour == 23) && (minute >= 58))
{
game_current = (game_current + addDayFour);
randomPartyBark("@Day 4.@");
}
}
else if (current_day == 4)
{
else if (current_day == 5)
{
else if (current_day == 6)
{
}
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: days in game
I try to keep my brackets in order as well as I can, because often i'll miss one and of course it destroys everything else until you find that missing or extra bracket.
I wish i had payed more attention on that cobol/java class i took. I've probably learned more here than there haha.
I wish i had payed more attention on that cobol/java class i took. I've probably learned more here than there haha.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/