Jump to content

Possible to have if statement inside command


Recommended Posts

Posted

Is it possible to place an IF statement inside a COMMAND?

 

I am compiling a block and I would like it to redefine the block when necessary.

 

(command "_.BLOCK" "BLOCK_NAME"

** line hypothetical (if block exist then redefine = y) **

0,0

sset

""

)

Posted

Put your if statement prior

(if (tblsearch "block" "blockname")
 (then do this); if the block exists
 (else do this));if the block doesn't exist

Posted

Johntosh,

 

For the scenario you are working with, check out the sysvar EXPERT. Setting it to 5 will bypass the redefine question.

 

[b][color=BLACK]([/color][/b]setq oldexp [b][color=FUCHSIA]([/color][/b]getvar [color=#2f4f4f]"EXPERT"[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]
[b][color=BLACK]([/color][/b]setvar [color=#2f4f4f]"EXPERT"[/color] 5[b][color=BLACK])[/color][/b]

[color=#8b4513];;;DO YOUR THING HERE[/color]

[b][color=BLACK]([/color][/b]setvar [color=#2f4f4f]"EXPERT"[/color] oldexp[b][color=BLACK])[/color][/b]

 

It is possible to do it inside the ( command ), but I would not recommend it. -David

Posted

Thanks guys!

 

That's a cute one, David.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...