Author Topic: Reverse a Command  (Read 1909 times)

0 Members and 1 Guest are viewing this topic.

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Reverse a Command
« on: September 01, 2016, 06:19:24 PM »
Hi, I've got a question. How do you, if at all possible, reverse a function or command? Such as have an action that reverses a command. I've tried using setOpposite and unless I'm doing it wrong it does nothing.

I've searched the forums and haven't found anything on this.

Thanks.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Reverse a Command
« Reply #1 on: September 01, 2016, 06:40:20 PM »
Take a look at an example in the ULX codebase: ulx gimp
This should give you the basic syntax for setting a command's opposite. Basically, you need a hidden Boolean argument, and you need to check if you need to reverse the logic in your command's function.

edit: It would be nice, though, if you provided us a sample of your code and explained your use case better (see below).
« Last Edit: September 03, 2016, 08:32:39 AM by Bytewave »
bw81@ulysses-forums ~ % whoami
Homepage

Offline Undercover Orange

  • Full Member
  • ***
  • Posts: 139
  • Karma: -14
  • Leader of Undercover Gaming Community
Re: Reverse a Command
« Reply #2 on: September 01, 2016, 07:52:08 PM »
Take a look at an example in the ULX codebase: ulx gimp
This should give you the basic syntax for setting a command's opposite. Basically, you need a hidden Boolean argument, and you need to check if you need to reverse the logic in your command's function.

I wonder if he means like a "ULX Undo" where it undoes the last ULX command executed. if so that would be cool if someone could get running smoothly.
~ Undercover Orange

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Reverse a Command
« Reply #3 on: September 01, 2016, 09:11:01 PM »
I wonder if he means like a "ULX Undo" where it undoes the last ULX command executed. if so that would be cool if someone could get running smoothly.
I've tried using setOpposite and unless I'm doing it wrong it does nothing.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.