Sign in to follow this  
Followers 0
WillieSea

Class #2 - Whats up with If, ElseIf, Else and EndIf

36 posts in this topic

Hi. I've got a question: is it possible to write a testing harness so that you don't have to run Oblivion to test something?

0

Share this post


Link to post
Share on other sites

What is a 'testing harness'?

You have to run Oblivion to test any mod. I have not heard of any other way to test a mod. :shrug:

0

Share this post


Link to post
Share on other sites

Alright. That's too bad. With Java (and I assume most modern languages), you can test parts of your code without testing all of it. Many IDE's will let you "step into" your code, too, for debugging but a harness is more powerful because it lets you catch programming mistakes that the compiler misses--like putting logical or instead of and, like I did.

I realize that that would probably be hard to implement in a game environment so I didn't think it would, but I thought there was no harm in asking.

0

Share this post


Link to post
Share on other sites

ShadeMe has released a runtime debugger, but it requires OBSE and is a little tempermental :D

0

Share this post


Link to post
Share on other sites

Hi, grEat class so far! It reminds me of the BASIC programing I learned waaaayyy back when.

I was tryin to figure out where you ot three nested if's. I thought of maybe putting in an initial message box asking if they thought they "Had the rep" with a yes or no choice. But I couldn't figure out the Button Choice stuff.

So, hopefully I'll have the simpler version running soon.

0

Share this post


Link to post
Share on other sites

The check script is in the mail PM box ... did it pass? (bribes with cookie :cookie4u: )

0

Share this post


Link to post
Share on other sites

I hope I won't be punished or treated like an idiot for this... :oblivion: Just so I know, does the 'DoOnce' command come before the 'Begin OnActivate'?

0

Share this post


Link to post
Share on other sites

:smarty: Scripting is one of the more difficult things you can do in the Construction Set, so there will be no flaming for asking questions. :)

DoOnce is actually just a variable name, it does nothing by itself. Since its a 'variable name' you can actually name it anything you want.

Whats important is 'HOW' you use the variable name to emulate 'doOnce' code execution. You only want to do the section of code once, so you use a variable to decide if that section of code has been done yet or not.

Since its a variable name, you 'define' it before your 'Begin' code, and then you 'use' it inside your Begin code as part of an 'IF' condition.

0

Share this post


Link to post
Share on other sites

No, its a variable definition and not part of the 'Begin' command.

All variable definitions go after the script name command and before all Begin statements.

scn MyFirstScript
short DoOnce
float myTime

Begin OnActivate
...
End[/code]

0

Share this post


Link to post
Share on other sites

I replaced the script from the ARSwitch activator we created during the last lesson to keep things simple. I tested my ESP and didn't encounter any problems. It would be nice to be able to see how others did it, but I understand why there are no solutions posted. In any case, it sure was fun, thank you!

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0