Grouped action specials in DECORATE

Moderator: GZDoom Developers

User avatar
Fishytza
Posts: 791
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

Re: Grouped action specials in DECORATE

Post by Fishytza »

Major Cooke wrote:So you could do this:

Code: Select all

POSS G 3
{
   if (health > 1)
      A_Jump(256,"Alive") //Or perhaps Goto Alive could work?
   else
      A_Jump(256,"Dead") //Or perhaps Goto Dead could work?
}
I don't think so. Didn't Randi say that braces for if statements are absolutely mandatory?

EDIT: Quick question. Are A_Jump* functions (when used in "grouped action functions") still going to work?
IE will something like this work?


EDIT2: Meh. I just remembered Graf saying that A_Jump and co. aren't allowed.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Grouped action specials in DECORATE

Post by Graf Zahl »

I never said that. The way this is implemented they are just regular functions.
User avatar
Dark-Assassin
Posts: 742
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: Grouped action specials in DECORATE

Post by Dark-Assassin »

Code: Select all

BOSS A 0 
{
   A_Jump(256, "AngryMissile") if ( health < 250 ) and random(0,100) <= 75;
   A_Jump(256, "SuperMegaUltimateMissile") unless random(0,100) >= 10 or ( health < 100 );
   A_Jump(256, "Missile");
}
Just throwing it out there. More of a Perl like alternative 1 liner If syntax. And can be &&, Or can be ||
But, maybe just ignore me. Especially since it's not C like. But I find it better than the non bracketed, new lined C like If/Else system;
User avatar
Fishytza
Posts: 791
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

Re: Grouped action specials in DECORATE

Post by Fishytza »

Graf Zahl wrote:I never said that. The way this is implemented they are just regular functions.
Hmm. Guess I misunderstood this bit:
Graf Zahl wrote:The scripting language won't allow a goto, it also won't allow A_Jump constructs, but real script syntax instead.
But nevermind that, I've got another question regarding A_Jump*:

Code: Select all

SARG A 5
{
	A_Jump(50, "Roar"); //If A_Jump decides to 'jump', will the rest below still run?
	A_Jump(20, "Snort");
	A_ActiveSound;
	A_Jump(100, "StandForAMoment");
	A_Jump(10, "Fart");
}
Last edited by Fishytza on Sun Jan 11, 2015 2:35 pm, edited 1 time in total.
User avatar
Dark-Assassin
Posts: 742
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: Grouped action specials in DECORATE

Post by Dark-Assassin »

I feel that any A_Jump should Terminate/Return when successful.
Instead just use If/Else statements with random(0,255) > whatever and additional actions before an A_Jump(255,"State"); (Obvious)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Grouped action specials in DECORATE

Post by Graf Zahl »

dark-slayer-201 wrote:s before an A_Jump(255,"State"); (Obvious)

Obviously you should use 256 instead of 255. :P
User avatar
Dark-Assassin
Posts: 742
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: Grouped action specials in DECORATE

Post by Dark-Assassin »

I always thought 255 as it's technically the 256'th number.
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: Grouped action specials in DECORATE

Post by Gez »

A_Jump jumps if the random number between 0 and 255 is under the value you give it. 255 is not less than 255, so if you used 255, there is one chance in 256 that it will not jump.

You can use any number greater than 255. So 256, or more.
User avatar
Dark-Assassin
Posts: 742
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: Grouped action specials in DECORATE

Post by Dark-Assassin »

Ah, that makes sense. Thanks for clearing that up.

Thought it was Less or Equal as A_JumpIfInventory and similar jump if Greater or Equal, not just Greater.
User avatar
Major Cooke
Posts: 8206
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: Grouped action specials in DECORATE

Post by Major Cooke »

Oh, wait. I was looking at the wrong piece of code. Yes, fishy, you're right, it does require braces.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Grouped action specials in DECORATE

Post by NeuralStunner »

Gez wrote:A_Jump jumps if the random number between 0 and 255 is under the value you give it. 255 is not less than 255, so if you used 255, there is one chance in 256 that it will not jump.
Also of note: If you only need one possible jump destination, it's better to use A_JumpIf and provide your own formula. "Random(1,10) == 1" is a much clearer way to express "1 in 10 chance".

Usually I avoid using A_Jump, unless I need a "virtual goto" for inheritance's sake.
jmickle
Posts: 92
Joined: Wed Feb 19, 2014 9:43 am

Re: Grouped action specials in DECORATE

Post by jmickle »

Glad to see this come in! Thanks a bunch Randi :)
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”