Go Back   Novahq.net Forum > Games > Joint Operations
FAQ Community Calendar Today's Posts Search

Joint Operations Anything about the Joint Operations series of games.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-07-2024, 07:34 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

WAC Limits?

Hi all. I'm making a fairly complex single player map for JO:E and have encountered an issue with my WAC scripts.

The problem is that I seem to have run into a limit. If I add any more scripts, they do not work. I have gone through each line to look for errors multiple times and have not found any.

It is always the last script or part of the last script in the file that does not work.

I have a Text script that prints "WAC 100%" at the end of the WAC to ensure the whole WAC is completing on map start. The only thing that gets the WAC to load 100% is to remove a script, any script. weather it's from the top or middle, as long as I remove something, it seems to work.

Have I hit some kind of memory limit? I thought maybe it was the number of lines in the WAC. The WAC is quite large at 1332 lines. although a lot of that is comment lines and such. But I have another map that has even more lines than this and has a bigger WAC file size and I have no issues with it.

I'm afraid I may have hit some sort of limit manipulating too many variables or something. The map involves things like a player money and inventory system, vehicle fuel system, and vehicle repair system. Also some interactions with NPC's.

I even tried removing all of my comment lines and such from the WAC.

Has anyone ran into this issue before with large WAC scripts?
Attached Images
File Type: jpg WAC script 1.JPG (103.0 KB, 13 views)
File Type: jpg WAC script 2.JPG (89.0 KB, 8 views)
Reply With Quote
  #2  
Old 07-07-2024, 10:59 PM
Baldo_the_Don is online now Baldo_the_Don
Baldo_the_Don's Avatar
Registered User

Join Date: Jul 2012
Posts: 585

Have you tried searching for permanent spaces? I think a permanent space gave me a .wac-induced headache once, or it was some other weird non-printable character of some sort, something you can type by accident, like with ctrl+shift+space or something dumb like that.

I vaguely recall a .wac or two that seemed to quit after a point, and I tried just moving the events around, and eventually, it stopped breaking, and I'm not sure if I ever found the actual problem, and there are few things in this world that I hate as much as breaking something with no clue as to how, but fixing something with no clue as to how is one of them.

Should also mention I write and edit all my .wacs by hand in notepad.exe, and mostly for DFBHD, so I might be lost on JO:E scripting.

Wish you all the luck, though.
__________________
////////////////////<- SIGNATURE STARTS ->\\\\\\\\\\\\\\\\\\\\\
The NSO Deadline Mod at NovaHQ.net:
/////////////////////<- SIGNATURE ENDS ->\\\\\\\\\\\\\\\\\\\\\\

Last edited by Baldo_the_Don; 07-08-2024 at 01:54 AM.
Reply With Quote
  #3  
Old 07-08-2024, 04:43 AM
jabo1SFH is offline jabo1SFH
jabo1SFH's Avatar
Registered User

Join Date: Jul 2019
Location: AZ
Posts: 530

try repositioning those non-read command lines to be on the side of another line. even though you do not want the game to read certain lines, i do believe they count against a perceived "limit".


also, make sure you dont have something in one of your command lines that is impossible for the game to execute.

edit: too many variables can cause issues. i know there are like 511 ish variables but i think most people didnt go too fsr into the 200's when using vars.


Reply With Quote
  #4  
Old 07-08-2024, 12:22 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

Thanks guys for the replies!

Quote:
Originally Posted by Baldo_the_Don View Post
Have you tried searching for permanent spaces? I think a permanent space gave me a .wac-induced headache once, or it was some other weird non-printable character of some sort, something you can type by accident, like with ctrl+shift+space or something dumb like that.
.
That's a good thing to check for. The text editor I use is Notapad++. It's like notepad but with a bunch of other helpful features. One thing you can do in it is make all invisible entries visible. This will show you every tab insert, every space, or any other invisible character. I turned it on and went through every script and found nothing out of the ordinary. I did remove some unnecessary tabs and spaces, but still no change.

Quote:
Originally Posted by jabo1SFH View Post
try repositioning those non-read command lines to be on the side of another line. even though you do not want the game to read certain lines, i do believe they count against a perceived "limit".
I tried removing all comment or non-read lines from the WAC file so that only the scripts were left, no change. so I don't think the comment lines are causing the issue

Quote:
Originally Posted by jabo1SFH View Post
also, make sure you dont have something in one of your command lines that is impossible for the game to execute.
I will try to go through and see if there are any logical errors. I've been trying to do this as I go, however. For example, I've tried to make sure one variable isn't trying to be changed by multiple scripts at once. I'm also making sure to limit scripts from constantly firing. For example, if you walk up to an NPC or object you can interact with, it will show on screen text. I have it set up so that the text only prints once, and then when you walk away from the NPC or object it will reset and show again the next time you're near that object. This way scripts are not firing every second for as long as the conditions are true. There's only a few scripts that do that. That being said, there is a LOT going on in this script, so there could be some sort of logical error somewhere. I'll do my best to try to find anything.

Quote:
Originally Posted by jabo1SFH View Post
edit: too many variables can cause issues. i know there are like 511 ish variables but i think most people didnt go too fsr into the 200's when using vars.
I'm currently only using 36 variables. I know in the screenshots you see that I'm using variables in the 100's, but that's only because I have skipped a number of variables to keep them kind of organized and give me room to use more variables for a specific mechanism, but I'm only actually using 36 different variables.



Here is what I've found since I posted this. It may have something to do with the number of Text("") strings I'm printing.

I noticed that if I remove some text from some of the text strings it fixes the issue! Not by removing the Text("") commands, but removing some of the text within the strings.

I tallied up all of my text in the game, There are 163 Text("") commands and 4414 characters of text that will be displayed on the screen through out the map.

So I took all of these lines and put them into a NEW test map WAC and found that it prints every line until text line 153 or 4246 characters! after that it cuts it off the rest of the text and won't let any WAC commands fire after that.

So maybe I'm hitting a memory limit to the number of Text("") lines or text character limit in the game??
Reply With Quote
  #5  
Old 07-08-2024, 02:57 PM
jabo1SFH is offline jabo1SFH
jabo1SFH's Avatar
Registered User

Join Date: Jul 2019
Location: AZ
Posts: 530

Quote:
Originally Posted by Oscarmike247 View Post
Thanks guys for the replies!




Here is what I've found since I posted this. It may have something to do with the number of Text("") strings I'm printing.

I noticed that if I remove some text from some of the text strings it fixes the issue! Not by removing the Text("") commands, but removing some of the text within the strings.

I tallied up all of my text in the game, There are 163 Text("") commands and 4414 characters of text that will be displayed on the screen through out the map.

So I took all of these lines and put them into a NEW test map WAC and found that it prints every line until text line 153 or 4246 characters! after that it cuts it off the rest of the text and won't let any WAC commands fire after that.

So maybe I'm hitting a memory limit to the number of Text("") lines or text character limit in the game??
hmmm, this seems interesting. ok, so text is just stuff that shows up in the regular chat area ingame. would using console command help or do you think that will count as text?





Reply With Quote
  #6  
Old 07-08-2024, 04:17 PM
Baldo_the_Don is online now Baldo_the_Don
Baldo_the_Don's Avatar
Registered User

Join Date: Jul 2012
Posts: 585

Oh. I know that in DFBHD(TS), if a text or consol message in the .wac has more than 63 characters between the double-quotes, the game will crash to desktop at 90% loadbar. In the DFWIQ and SFOD mods I experiment in, if a text or consol message in the .wac has more than 63 characters between the double-quotes, the game just doesn't display any more than the first 63 characters in that line.

Maybe there's a text buffer that's overrunning. Maybe you're onto something.
__________________
////////////////////<- SIGNATURE STARTS ->\\\\\\\\\\\\\\\\\\\\\
The NSO Deadline Mod at NovaHQ.net:
/////////////////////<- SIGNATURE ENDS ->\\\\\\\\\\\\\\\\\\\\\\
Reply With Quote
  #7  
Old 07-08-2024, 04:19 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

Quote:
Originally Posted by jabo1SFH View Post
hmmm, this seems interesting. ok, so text is just stuff that shows up in the regular chat area ingame. would using console command help or do you think that will count as text?

Good question. Im currently using console to display player info such as money in his wallet and items he's holding. Next time im at my PC I'll test it and see.
Reply With Quote
  #8  
Old 07-08-2024, 06:24 PM
jabo1SFH is offline jabo1SFH
jabo1SFH's Avatar
Registered User

Join Date: Jul 2019
Location: AZ
Posts: 530

Quote:
Originally Posted by Baldo_the_Don View Post
Oh. I know that in DFBHD(TS), if a text or consol message in the .wac has more than 63 characters between the double-quotes, the game will crash to desktop at 90% loadbar. In the DFWIQ and SFOD mods I experiment in, if a text or consol message in the .wac has more than 63 characters between the double-quotes, the game just doesn't display any more than the first 63 characters in that line.

Maybe there's a text buffer that's overrunning. Maybe you're onto something.
just checked jo and we get 59 characters to display in an ingame message, so that probably would be max for a wac text command.


Reply With Quote
  #9  
Old 07-08-2024, 07:43 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

Quote:
Originally Posted by jabo1SFH View Post
just checked jo and we get 59 characters to display in an ingame message, so that probably would be max for a wac text command
What I found was a 63 character limit per Text command.

if I do the following in the WAC...

Text("1.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U. V.W.X.Y.Z.1.2.3.4.5.6.7.8.9.0")

in game I get...

1.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X. Y.Z.1.2.3.4.5

Which is 63 characters.
Attached Images
File Type: jpg WAC script 4.JPG (16.1 KB, 7 views)
File Type: jpg Joint Operations Typhoon Rising Screenshot 2024.07.08 - 20.34.50.26.jpg (102.7 KB, 4 views)
Reply With Quote
  #10  
Old 07-08-2024, 07:53 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

As I found in my previous reply, there seems to be a 63 char limit per text command. Now my question was, is there a Text command limit, or a character limit? or both?

So I made a script with text commands

Text("1")
Text("2")
Text("3")
Text("4")
Text("5")
Text("6")
Text("7")
Text("8")
Text("9")
Text("10") ....

Text("198")
Text("199")
Text("200")

all the way to 200 text lines (much more than my map WAC that is failing), and it printed every line just fine. So there doesn't seem to be an issue there.

Next I started testing for a character limit. So I set up about 70 text lines each containing 63 chars. See screenshots.

As you can see, it stopped at "65.A.B.C.D.E.F."

So it appears that the char limit for text is 4,047 characters.

Now I'll test if the Console text is included in this...

Edit: Yes, the console text is included in this 4047 character limit.
Attached Images
File Type: jpg WAC script 3.JPG (190.5 KB, 8 views)
File Type: jpg Joint Operations Typhoon Rising Screenshot 2024.07.08 - 20.34.50.27.jpg (156.5 KB, 9 views)

Last edited by Oscarmike247; 07-08-2024 at 10:07 PM.
Reply With Quote
  #11  
Old 07-08-2024, 10:05 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

To remedy the issue, I came up with a way to drastically reduce the text used in the map. Most of my text lines were the same or similar messages just repeated under different scripts. So I took all of the text lines that were the same and used in multiple scripts and set them up with a single variable. In this case v9...

So I can do this...

if eq(v9, 1) then Text("Text string 1") endif
if eq(v9, 2) then Text("Text string 2") endif
if eq(v9, 3) then Text("Text string 3") endif

Then add a script to automatically set the text variable v9 back to 0 after it's used, this way the text doesn't keep repeating when it is called on by another script...

If gt(v9, 0) and elapse(1) then
set(v9, 0)
endif

Now when ever I want to use these text strings in multiple scripts, instead of doing this...

If CONDITION then
Text("Text String 1")
endif

I can do this...

If CONDITION then
Set(v9, 1) //Text String 1
endif

This allows me to use the same 'Text(" ") command over several scripts without using up more of the character limit.

In some cases I had up to 11 different scripts using the same text line. I did this process for every text line that was used more than once and reduced my total characters from 4,246 to 1,639 characters.

That's a big difference. Sorry I'm rambling on, but maybe someone else can use this in the future.
Reply With Quote
  #12  
Old 07-08-2024, 10:42 PM
jabo1SFH is offline jabo1SFH
jabo1SFH's Avatar
Registered User

Join Date: Jul 2019
Location: AZ
Posts: 530

hell, great find. too bad all the old sites are gone. i do recall the guys over at CMHQ were discussing wac limitations and there were theories about this but nothing definitive.


Reply With Quote
  #13  
Old 07-16-2024, 08:52 AM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

Well I'm having more issues. This time getting a crash when the map gets to the end of the loading bar.

I fear I may have reached some other sort of limit. This time it seems to be with actual If statements. if I add anymore scripts, it crashes, even if the script has no actions in it.

I'm currently at 314 if statements.

Is there no dump file or any way for me to know what exactly causing the crash?

I checked for a sysdump.txy but it doesn't generate one.
Reply With Quote
  #14  
Old 07-16-2024, 09:57 PM
jabo1SFH is offline jabo1SFH
jabo1SFH's Avatar
Registered User

Join Date: Jul 2019
Location: AZ
Posts: 530

Quote:
Originally Posted by Oscarmike247 View Post
Well I'm having more issues. This time getting a crash when the map gets to the end of the loading bar.

I fear I may have reached some other sort of limit. This time it seems to be with actual If statements. if I add anymore scripts, it crashes, even if the script has no actions in it.

I'm currently at 314 if statements.

Is there no dump file or any way for me to know what exactly causing the crash?

I checked for a sysdump.txy but it doesn't generate one.

i dont remember how many the limit is, but there is one for the wac file. there is also a limit in the med but i think the way to possibly get around that is to "nest" if statements to a specific event in the wac similar to how you can choose several if/then statements per event in the med scripting.





Last edited by jabo1SFH; 07-16-2024 at 10:17 PM.
Reply With Quote
  #15  
Old 07-16-2024, 10:18 PM
jabo1SFH is offline jabo1SFH
jabo1SFH's Avatar
Registered User

Join Date: Jul 2019
Location: AZ
Posts: 530

something like this:

Code:
if gt(v56,100) then
	if elapse(60) then
		if random(4) then
			set(v58,0)
			overcast(40,20)
			skyspeed(30)
			fogdist(512)
			Rain(35,20)
		else
			if eq(rnd,2) then
				set(v58,3)
				overcast(15,20)
				skyspeed(20)
				fogdist(682)
				Rain(0,20)
				wave("wren8.wav")
			endif
		else
			if eq(rnd,3) then
				set(v58,0)
				overcast(60,20)
				skyspeed(40)
				fogdist(341)
				Rain(65,20)
			endif
		else
			if eq(rnd,4) then
				set(v58,1)
				overcast(100,20)
				skyspeed(60)
				fogdist(204)
				Rain(100,20)
				farflash()
				set(v58,1)
			endif
		else
			if eq(rnd,5) and eq(v58,1) then
				flash()
				wave("gustb_4.wav")
			endif
		endif
	endif
	if elapse(25) and eq(v58,1) then
		flash()
	endif
	if elapse(55) and eq(v58,3) then
		wave("wren8.wav")
	endif
	if eq(v56,102) then
		set(v56,100)
		set(v58,0)
		fogdist(1024)
		skyspeed(23)
		overcast(0,20)
		Rain(0,20)
		wave("wren8.wav")
	endif
endif

thats how nile generates a nesting for a wac file.


Reply With Quote
  #16  
Old 07-17-2024, 06:16 AM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

Nesting them doesn't seem to affect the crashing. In my testing, it doesn't seem to matter it the "If" statement is nested in another or not. If I go over 313, it seems to crash.

This also goes for "elseIf" statements.

I have been able to go through my WAC and optimize many of them. I was able to reduce the number of if statements used by using different methods or structuring them differently to achieve the same affect. but so far I was only able to knock it down to 308 If's. Which is concerning because I still have more I need to add to the map.

Worth noting, MED events do not seem to affect the crash. so I may need to go through the WAC scripts and see what events I can create in the MED events instead.

Here's some examples of scripts that have some nesting. Do I have them structured correctly? Ignore the ";c" and ";e" I just use those in Notepad++ to collapse scripts.

Code:
		;c //v102	Gas level SSN 15 TAXI
		if medrive(15) and gt(v102, 0) and elapse(12) then //Drains gas when driving
		dec(v102)
		endif
		If true(V108) and lt(v102, 1) then //disables vehicle when out of gas
		disablessn(15)
			elseif true(v108) and gt(v102, 0) then //enables vehicle if> it has gas
			enablessn(15)
			endif
		endif
		;e
		;c //Vehicle Repair Taxi 		SSN 15
		if (ssnseesssn(player, 15, 5) or ssnonssn(player, 15)) and weaponfired(1) and ssnalive(15) then
			if gt(v3,0) then //if player has spare parts
			Set(v9, 1) //text("Repaired Vehicle")
			SSNADDHP(15, 250) //Add HP to vehicle
			dec(V3)	//Remove one spare parts from player inventory
			ss2ssn(FARP, 15)
				else
			set(v9,2) //Text("<cff0000>Not enough parts to repair vehicle") //Text Color RED
			endif
				if gt(v54, 0) and le(v102, 85) then //Refuel vehicle from player's gas can
				add(v102, v54) //add fuel to vic
				sub(v54, v54) //remove from inventory
				Text("fueled from gas can")
				endif
		endif
		;e

Last edited by Oscarmike247; 07-17-2024 at 06:30 AM.
Reply With Quote
  #17  
Old 07-18-2024, 10:49 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

I'm not sure what exactly is going on here, I just know that this happens...

So I did some optimizing and restructuring of my WAC scripts and was able to knock my total scripts down from 314 to 282 without losing any features or events in the map. which is cool. But I did this because it seemed that my new crashing issue was related to the number of scripts. Again, if I removed any script, it would work. then if I even added a script with no conditions or actions (If then endif) it would crash.

So, after reducing everything down, I figured I could go ahead and start adding more scripts for another part of the map. I added 4 new scripts, loaded the map and it crashed again on load.

So I deleted the new scripts until I was one script away from triggering a crash. then I added an if statement with no conditions or actions (if then endif).

If I add this script at the end of my WAC, the map runs fine, but if I place it anywhere ABOVE the last script in the WAC or even at the very start, it causes a crash.

So I added my new scripts to the bottom of the WAC instead of in the middle, and boom, it runs fine.

It's starting to sound similar to Baldo's issue. but like him, I might be able to fix it by moving scripts around, but I'm frustrated not knowing what the hell is going on to cause the crash. Also disappointed that I wont be able to keep my scripts organized since I have to add new ones to the bottom.
Reply With Quote
  #18  
Old 07-19-2024, 07:17 AM
Baldo_the_Don is online now Baldo_the_Don
Baldo_the_Don's Avatar
Registered User

Join Date: Jul 2012
Posts: 585

I can't help thinking that if certain hexes or certain strings of hexes in certain lines or at certain positions in lines with certain values are present in a .wac file, the game gets weird about it.

Like if, semi-randomly exampled, 0D and 0A are the 71st and 72nd characters in a line, the game misinterprets it as a line break, and can do nothing with it, or anything after it. Or some other arcane misreading of some character chain as an invalid control order.

I don't know exactly what I'm talking about, so I can't exactly express it cogently, but if just cutting a .wac event out and inserting it in a different postion in a .wac file fixes the script or changes where the script breaks, that means something, doesn't it?
__________________
////////////////////<- SIGNATURE STARTS ->\\\\\\\\\\\\\\\\\\\\\
The NSO Deadline Mod at NovaHQ.net:
/////////////////////<- SIGNATURE ENDS ->\\\\\\\\\\\\\\\\\\\\\\
Reply With Quote
  #19  
Old 07-19-2024, 08:09 AM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

Quote:
Originally Posted by Baldo_the_Don View Post
I can't help thinking that if certain hexes or certain strings of hexes in certain lines or at certain positions in lines with certain values are present in a .wac file, the game gets weird about it.

Like if, semi-randomly exampled, 0D and 0A are the 71st and 72nd characters in a line, the game misinterprets it as a line break, and can do nothing with it, or anything after it. Or some other arcane misreading of some character chain as an invalid control order.

I don't know exactly what I'm talking about, so I can't exactly express it cogently, but if just cutting a .wac event out and inserting it in a different postion in a .wac file fixes the script or changes where the script breaks, that means something, doesn't it?
I completely agree. It must be an issue with how the game reads it or something. The game reads the WAC from top to bottom if I'm not mistaken, so maybe there's some sort of logic error in how it's reading things in a certain order?

I've gone through my script for the 10th time, looking for anything that's misprinted or wrong. Also using Notepad++ helps a lot with this, because I have it set up to read the WAC language. so it can tell me if an "if" statement is missing an "Endif" somewhere for example. I'm pretty confident there are no errors in my scripts.

I've also noticed that if I even just add a new action to one of the scripts above the the break point, it will also cause it to crash. I don't think that was happening the last time I ran into this.

For now, I have created a comment line in my WAC, and anything new will have to be added below that line, which seems to work.
Reply With Quote
  #20  
Old 07-20-2024, 04:51 AM
jabo1SFH is offline jabo1SFH
jabo1SFH's Avatar
Registered User

Join Date: Jul 2019
Location: AZ
Posts: 530

yeah, always add new wac events towards the botto, especially if you have break lines in them. the game reads the entire wac something like 2x per second or something similar so it will fire an event if the condition has been met with the next read-through.


also, at the very bottom of your wac, leave a 1 line return space. i remember reading that it helps the game understand that is the end of all scripting.



Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:52 AM.




Powered by vBulletin®