Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

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


WillieSea
 Share

Recommended Posts

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.

Link to comment
Share on other sites

  • 4 weeks later...

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.

Link to comment
Share on other sites

  • 3 months later...

: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.

Link to comment
Share on other sites

  • 3 years later...
  • 4 years later...

Good tutorial, although I really needed the example in the comics and the teachers notes, as well as CSE's helpful interface in pointing out errors in the code, to complete this tutorial. I know this thread is eight-years dead, and I doubt Williesea is around to grade homeworks, so I'm posting mine in the comments so other people can see what a completed and working script looks like. Mind, you script doesn't have to look exactly like this. There are variations to doing this. But if you're having trouble and need help, you can look at mine for reference.

Spoilers for the homework!

-

-

-

-

-

Spoilers for the homework!

-

-

-

-

-

Spoilers for the homework!

-

-

-

-

-

scn WeaponForTheWorthy

short doOnce

short plrFame

short plrInfamy

Begin OnActivate

set plrFame to (GetPCFame)

set plrInfamy to (GetPCInfamy)

	If (doOnce == 0)

		If (GetPCFame >= 50) || (GetPCInfamy >= 50)

			If (GetPCFame > GetPCInfamy)

				MessageBox "You are famous enough!"

				player.additem 00035DD4, 1

				set doOnce to 1

			Else

				MessageBox "You are infamous enough!"

				player.additem 00035DD4, 1

				set doOnce to 1

			EndIf

		Else

			MessageBox "You are a nobody!"

		EndIf

	Else

		MessageBox "You already received your gift!"

	EndIf

End

 

Edited by Fiore1300
Link to comment
Share on other sites

  • 3 years later...

I've decided to start learning scripting Cobl via the tutorials on the CS Wiki, cited at the start of your own tutorial.

I have a couple of questions:

First, how do you get Notepad++ to recognize Cobl scripting? I only noticed COBOL, with regard proximity to the suggested term "Cobl";

Second, I'm curious about GetIsPlayableRace. The info suggested ShowRaceMenu, though what FLAGs are used to identify Character Race/Species? i.e. What function do I use in a Script to query what Race the Player chose? "GetPlayerRace" would be a guess as to a similitude to what I'm looking to figure out. How does Oblivion store that info? I want to make SpeciesFactions & bases, or campsites, for each of the Species: Argonian, Khajiit, Wood Elf, Altmer, Dunmer, etc.

 

Edited Note:

I found it!! Uhh, I installed the user defined Oblivion Scripts xml file for Notepad++, located upon the Nexus site.

As well, it's the function "GetRace". Though, there's no info in that wiki about the ref FLAG info for various things, not actually.

I have quite a lot of Scripting experience, so I perused that site sort of quickly, & I think I'm ready.

Edited by Jareth77
Found what I was looking for.
Link to comment
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...