Announcement: Remember: you are giving away your fantastic ideas for free, and somebody else might even make money from them (or appear to). That's just how the world works! If you're worried about it, maybe you shouldn't post your ideas here.


Caravel Forum : DROD Boards : Feature Requests : Complex conditionals
New Topic New Poll Post Reply
Poster Message
averagemoe
Level: Smiter
Avatar
Rank Points: 487
Registered: 03-22-2012
IP: Logged
icon Complex conditionals (+2)  
It occured to me that it's a little inefficient that when you want multiple triggers for something in a custom script, you have to provide a separate If Statement for each of them. So I thought of the idea of a new class of "Logic Commands"

The first would be "Wait for logic" which starts of one of these complex conditionals. There would also be "End Logic" to indicate the end. They can even be nested. Any "wait for" or "wait while" commands placed between these will be considered parts of the same condition.

There would also be commands that serve as logic functions. "AND", "OR", and "XOR"

Now, to clarify with an example. Suppose you want to check if the player is in any of three different sections of the room, and there are monsters in one, but not both other sections. It might look something like this.

Wait For Logic
   Wait For Logic
      Wait For Entity Player at (coordinates)
      Or
      Wait For Entity Player at (coordinates)
      Or
      Wait For Entity Player at (coordinates)
   Logic End
   And
   Wait for Logic
      Wait For Entity Monster at (coordinates)
      XOR
      Wait For Entity Monster at (coordinates)
   Logic End
Logic End


____________________________
There are two types of sheep in the world. Those who jump off a bridge when told to, and those who jump off a bridge when told not to. Don't be either.

[Last edited by averagemoe at 12-30-2021 02:39 AM]
12-29-2021 at 11:46 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1527
Registered: 06-13-2015
IP: Logged
icon Re: Complex conditionals (0)  
Definitely has my support. Something like this would really cut down on irritating, repetitive, long-winded if-else if-else if blocks where the exact same command happens after every if.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 12-30-2021 02:47 AM]
12-30-2021 at 02:47 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
averagemoe
Level: Smiter
Avatar
Rank Points: 487
Registered: 03-22-2012
IP: Logged
icon Re: Complex conditionals (+2)  
Actually, I think I just came up with a better format. Maybe it's because I have only a layman's understanding of boolean logic, but I can't figure out different types of operations interacting without nesting.

So instead of having the "AND"s "OR"s and "XOR"s between the conditions, integrate it into the command that starts the bracket. I'll use the same hypothetical as above for my example.

Wait And
   Wait Or
      Wait for Entity Player at (coordinates)
      Wait for Entity Player at (coordinates)
      Wait for Entity Player at (coordinates)
   Logic End
   Wait XOR
      Wait for Entity Monster at (coordinates)
      Wait for Entity Monster at (coordinates)
   Logic End
Logic End


____________________________
There are two types of sheep in the world. Those who jump off a bridge when told to, and those who jump off a bridge when told not to. Don't be either.
12-30-2021 at 06:58 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5056
Registered: 02-04-2003
IP: Logged
icon Re: Complex conditionals (0)  
A most excellent PR by hyperme. Thank you!

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.

[Last edited by mrimer at 02-18-2022 12:45 AM]
02-18-2022 at 12:45 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Feature Requests : Complex conditionals
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.