Jump to content

Need a fresh pair of eyes.


Vagrant0

Recommended Posts

Alright, I've been banging my head against the wall for some time now. Trying to make my mod compatable with open cities without having to release more than one version. This means moving some markers and stuff around through scripting. I was able to do that alright, and I've played with the settings quite a bit to make sure that if everything answers right, everything would be in the right spot. However, for some reason my scripting conditions don't seem to be working right.

 

I'm controlling all this through a global variable "OpenCities" by default it is 0, but by using another mod loaded afterward, it becomes 1. I have tested this in game through a message command in console. Indeed, in game it returns as 1. However, despite everything I've tried, the script keeps treating this as 0, even when I check with the message command, despite the message returning it as 1, it still gets treated as a 0.

 

Below is a chopped up portion of the script.

short OC

short makechange

 

begin gamemode

 

set OC to OpenCities

if makechange != 1

if OC == 0

VG0ChorrolPack01Marker.positionworld -66348, 97081, 14464, 0, ChorrolWorld

message "Something feels wrong."

set Opencities to 0

set makechange to 1

elseif OC == 1

VG0ChorrolPack01Marker.positionworld -66166, 97586, 14482, 0, Tamriel

message "Something feels different."

set Opencities to 1

set makechange to 1

endif

endif

end

 

The odd part is that although the "something feels wrong" message comes up, the global variable doesn't change to 0, it stays at 1. I'm tempted to think that this is just some easy mistake that I'm just not seeing.

Link to comment
Share on other sites

How is the Opencities declared? Where?

Why set the Opencities to 0? Your script only runs, if it is 0 already?

 

Opencities is set as a new global variable, like timescale, and the hotel functions. It stands on itself so that I can use it in several other places where needed. I tried with it being in both the base mod (as 0) and with an enabler mod (as 1), as well as just having the enabler loaded while removing the global variable from the base mod. Both situations had the same result.

 

Trying to get it to run off the settings in the enabler mod, where they would be set to 1, not 0. Although the global variable does get changed, the script doesn't recognize it as being anything but 0 even after being updated.

 

I'm now thinking that my approach might be wrong. Instead of trying to get an enabler working as a side mod, I should probably tune some logic functions within the main package to determine if opencities is active or not, making it automatically detect and adjust.

 

Yeah, I realize alot of this stuff is kinda out there on many levels. But a change of approach might be the better solution. This will also make it a bit more user friendly as all they would need to do is start it up, and everything adjusts. Provided of course I can make the logic stuff work right amidst a population that loves senseless slaughter of non-essentials.

Link to comment
Share on other sites

If I'm not wrong, loading a base mod with a value of 0, and an enabler with a value of 1 would conflict? The value would depend on the loading order? This might be the problem?

 

The odd part is that although the "something feels wrong" message comes up, the global variable doesn't change to 0, it stays at 1. I'm tempted to think that this is just some easy mistake that I'm just not seeing.

This part

if OC == 0
VG0ChorrolPack01Marker.positionworld -66348, 97081, 14464, 0, ChorrolWorld
message "Something feels wrong."
set Opencities to 0
set makechange to 1
elseif OC == 1
VG0ChorrolPack01Marker.positionworld -66166, 97586, 14482, 0, Tamriel
message "Something feels different."
set Opencities to 1
set makechange to 1

Sets OpenCities to 1 if it already is 1, and 0 if it equals 0. No logic to me.

 

Would using an existing referrence work?

Example:

The door to the castle has the unique id of "DoorToBob".

scn imbob

short OpenCities
short ionlyliveonce

Begin Gamemode
If ( ionlyliveonce < 1 && ("DoorToBob".GetInWorldspace Tamriel) == 1)
set ionlyliveonce to 1
set OpenCities to 1
else
set ionlyliveonce to 1
set OpenCities to 0
endif
end

Whenever you need to check if OpenCities is enabled, you use something like this?

IF (imbob.OpenCities == 1)
; Opencities: Loaded
; Place marker in Tamriel
ELSE
; Opencities:  Not loaded
; Place marker in Chorrol.
ENDIF

 

Do this work in other scripts, or is it just this one?

Link to comment
Share on other sites

I was making sure the loading order was right, and indeed by checking with a message command "message "global = %g" "opencities"" it was returning 1.

 

The reason why it was being set to 0 if 0, or 1 if 1 was hopefully so that I could see the change in the global through the message. This didn't work however.

 

The problem with a door ref is that the opencities mod adds doors, markers, adjusts packages, and such. I kinda see where you're going, but that would require me to edit a door used in this process, possibly breaking that mod. I think I have the detection stuff figured out, it'll just be a bit more complicated to do.

 

At current I only have 1 marker I'm moving, used by 3-4 packages. That probably doesn't seem to be worth this much trouble, but I would rather have the system figured out early so that I can plan more later. As opposed to having 20+ markers and 40+ packages that I'd have to deal with at the same time.

 

This is actually one of my last steps before releasing a limited alpha for people to test. I wanted this done because if I didn't do it now it would be among the first things suggested.

Link to comment
Share on other sites

Anyway, found a nice solution to the problem which isn't any more complicated, and works rather nicely without much chance of getting broken. Best of all, it can still adjusted directly through console, so correcting any mistakes that I havn't thought of would be just as easy as typing the command. Since this method can be applied to any of the cities rather easily, I won't have to change tactics later on. You were however some help, the "getinworldspace" function was the key to this mess. I still have a bit more checking to do to make sure everything works right though.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...