[Scripting]Brackets not allowed to be C-style?

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Major Cooke
Posts: 8219
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

[Scripting]Brackets not allowed to be C-style?

Post by Major Cooke »

In an attempt to make it as crash prone as possible to see where it fails to load and where it will actually crash in the game, this is the first.

I for one do not wish to program like the notorious Java syntax, so I would appreciate if C-style was allowed.

(Yes I'm aware there's things like Goto statements not allowed. I'm just doing a favor by ensuring it's actually throwing an error.)

Gives an error, about needing 4 sprite characters.

Code: Select all

Actor ShrapExplosion
{
	var int user_smokecount;
	var int user_ringcount;
	+NOINTERACTION
	States
	{
	Spawn:
		TNT1 A 0 
		TNT1 A 0
		{ //<-------------------------------------------------Right here, it fails to load.
			A_SetUserVar("user_smokecount",0);
			A_SetUserVar("user_ringcount",0);
			A_CheckFloor("FloorLand");
			A_CheckCeiling("CeilingLand");
		}
	Air:
		TNT1 AAA 0 A_SpawnItemEx("ShrapBack1",frandom(2,4),0,frandom(-2,2),frandom(0,0.6),0,frandom(-0.2,0.2),frandom(0,359.9),32)
		TNT1 AAAAA 0 A_SpawnItemEx("ShrapBack1",frandom(2,4),0,frandom(-2,2),frandom(0,0.6),0,frandom(-0.2,0.2),frandom(0,359.9),32,128)
		AirSmokeLoop:
			TNT1 A 1 {
			if (user_smokecount < 50) 
			{
				A_SpawnItemEx("ShrapSmoke1",frandom(0,1),0,frandom(-1,1),frandom(2,3),0,frandom(-3,3),frandom(0,359.9),32);
				A_SetUserVar("user_smokecount",user_smokecount+1);
			}
			else
			{ Goto AirRingLoop }}	
			//TNT1 A 0 A_JumpIf(user_smokecount >= 50,1)
			Loop
		AirRingLoop:
			TNT1 A 0 A_SpawnItemEx("ShrapSmoke2",frandom(0,1),0,0,frandom(3,5),0,0,frandom(0,359.9),32)
			TNT1 A 0 A_SetUserVar("user_ringcount",user_ringcount+1)
			TNT1 A 0 A_JumpIf(user_ringcount>=35,1)
			Loop
		TNT1 A 1
		Stop
	FloorLand:
		TNT1 AAA 0 A_SpawnItemEx("ShrapBack1",frandom(0,4),0,frandom(0,2),frandom(0,0.6),0,frandom(0,0.6),frandom(0,359.9),32)
		TNT1 AAAAA 0 A_SpawnItemEx("ShrapBack1",frandom(0,4),0,frandom(0,2),frandom(0,0.6),0,frandom(0,0.6),frandom(0,359.9),32,128)
		FloorSmokeLoop:
			TNT1 A 0 A_SpawnItemEx("ShrapSmoke1",frandom(0,1),0,frandom(0,1),frandom(2,3),0,frandom(0,3),frandom(0,359.9),32)
			TNT1 A 0 A_SetUserVar("user_smokecount",user_smokecount+1)
			TNT1 A 0 A_JumpIf(user_smokecount>=50,1)
			Loop
		FloorRingLoop:
			TNT1 A 0 A_SpawnItemEx("ShrapSmoke2",frandom(0,1),0,3,frandom(3,5),0,0,frandom(0,359.9),32)
			TNT1 A 0 A_SetUserVar("user_ringcount",user_ringcount+1)
			TNT1 A 0 A_JumpIf(user_ringcount>=35,1)
			Loop
		TNT1 A 1
		Stop
	CeilingLand:
		TNT1 AAA 0 A_SpawnItemEx("ShrapBack1",frandom(0,4),0,frandom(-2,0),frandom(0,0.6),0,frandom(-0.6,0),frandom(0,359.9),32)
		TNT1 AAAAA 0 A_SpawnItemEx("ShrapBack1",frandom(0,4),0,frandom(-2,0),frandom(0,0.6),0,frandom(-0.6,0),frandom(0,359.9),32,128)
		CeilingSmokeLoop:
			TNT1 A 0 A_SpawnItemEx("ShrapSmoke1",frandom(0,1),0,frandom(-1,0),frandom(2,3),0,frandom(-3,0),frandom(0,359.9),32)
			TNT1 A 0 A_SetUserVar("user_smokecount",user_smokecount+1)
			TNT1 A 0 A_JumpIf(user_smokecount>=50,1)
			Loop
		CeilingRingLoop:
			TNT1 A 0 A_SpawnItemEx("ShrapSmoke2",frandom(0,1),0,-3,frandom(3,5),0,0,frandom(0,359.9),32)
			TNT1 A 0 A_SetUserVar("user_ringcount",user_ringcount+1)
			TNT1 A 0 A_JumpIf(user_ringcount>=35,1)
			Loop
		TNT1 A 1
		Stop
	}
}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Scripting]Brackets not allowed to be C-style?

Post by Graf Zahl »

The obvious problem here is, that line feeds normally end a state definition, so handling this case may create some problems with backwards compatibility.
User avatar
Major Cooke
Posts: 8219
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: [Scripting]Brackets not allowed to be C-style?

Post by Major Cooke »

But brackets are never used anywhere else except for two things, the start of an actor definition and states.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Scripting]Brackets not allowed to be C-style?

Post by Graf Zahl »

Correct, but since states end with a line feed, this case will need some special treatment that may not be 100% backwards compatible because the read position needs to be advanced before deciding that it needs to continue as normal, so this will require careful investigation first.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Scripting]Brackets not allowed to be C-style?

Post by Graf Zahl »

Ok, did something.

Can you test, I'm not 100% sure about it.
User avatar
Major Cooke
Posts: 8219
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: [Scripting]Brackets not allowed to be C-style?

Post by Major Cooke »

Okay, but first, there's a compile issue with the latest pull. Mainly, Flags & TF_OVERRIDE. Easy to fix, just uncapitalize the f in "flags".
Last edited by Major Cooke on Sat May 02, 2015 3:33 pm, edited 2 times in total.
User avatar
Major Cooke
Posts: 8219
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: [Scripting]Brackets not allowed to be C-style?

Post by Major Cooke »

Alright that worked! Thanks Graf! :D
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Scripting]Brackets not allowed to be C-style?

Post by Graf Zahl »

Major Cooke wrote:Okay, but first, there's a compile issue with the latest pull. Mainly, Flags & TF_OVERRIDE. Easy to fix, just uncapitalize the f in "flags".
Yeah, for some reason Randi changed nearly all parameter variables in the action functions which creates endless merging conflicts.
Can you imagine how much time I already wasted on that shit? That's one of the reasons why I want to see this through and get merged.
User avatar
Major Cooke
Posts: 8219
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: [Scripting]Brackets not allowed to be C-style?

Post by Major Cooke »

I can imagine, man. I can imagine. x_x;

Heh, for your sake, practicality so you don't have to put up with it anymore. For everyone else's? It's Scripting.
Post Reply

Return to “Closed Bugs [GZDoom]”