Wolf's Whats wrong with my script thread

Post » Fri May 27, 2011 1:08 pm

All scripts will have a title ( starting with script 01 )
just respond by quoting script XX and help me with the script ( sometimes i may have 3 or 4 scripts i need help with and its easier this way ) -personal link- http://webpages.charter.net/manauser/morrowind/indenter.htm


Script 01
Short DoOnceShort AspectIf ( DoOnce == 0 )	Set DoOnce to 1	setfatigue -1 endifIf ( DoOnce == 1 )	If ( bm_frost_giant->Gethealth <= 0 )		Set DoOnce to 2		Setfatigue 300	endifendifIf ( Journal BM_WildHunt == 87 )	If ( DoOnce == 2 )		Set DoOnce to 3		Startcombat "BM_hircine_straspect"		Messagebox, "I will help you"		Set aspect to 1	endifendifIf ( Journal BM_Wildhunt == 88 )	If ( DoOnce == 2 )		Set DoOnce to 3		Startcombat "BM_hircine_spdaspect"		Messagebox, "I will help you"		Set aspect to 2	endifendifIf ( Journal BM_Wildhunt == 89 )	If ( DoOnce == 2 )		Set DoOnce to 3		Startcombat "BM_hircine_huntaspect"		Messagebox, "I will help you"		Set aspect to 3	endifendifIf ( DoOnce == 3 )	If ( Aspect == 1 )		If ( BM_hircine_straspect->Gethealth <= 0 )			Set DoOnce to 4 			position, -23802, -13353, 1965, 0		endif	endifendifIf ( DoOnce == 3 )	If ( Aspect == 2 )		If ( BM_hircine_spdaspect->Gethealth <= 0 )			Set DoOnce to 4 			position, -23802, -13353, 1965, 0		endif	endifendifIf ( DoOnce == 3 )	If ( BM_hircine_huntaspect->Gethealth <= 0 )	If ( Aspect == 3 )		Set DoOnce to 4 		position, -23802, -13353, 1965, 0	endifendifendif

User avatar
Javaun Thompson
 
Posts: 3397
Joined: Fri Sep 21, 2007 10:28 am

Post » Fri May 27, 2011 3:38 am

You're missing an endif in the final block.
Edit: And the script would be much clearer if you used elseif instead of only endif and if. Elseif is there to simplify a lot of the cases you've expanded.
User avatar
ezra
 
Posts: 3510
Joined: Sun Aug 12, 2007 6:40 pm

Post » Fri May 27, 2011 3:29 am

You're missing an endif in the final block.
Edit: And the script would be much clearer if you used elseif instead of only endif and if. Elseif is there to simplify a lot of the cases you've expanded.

Ive never understood elseifs... I remember 3 or 4 pages of people trying to explain it to me but ive never grasped it.
Edit: and there were 3 endifs i just accidentally cut one off when i quoted it. I fixed it in the OP.
User avatar
Heather Stewart
 
Posts: 3525
Joined: Thu Aug 10, 2006 11:04 pm

Post » Fri May 27, 2011 12:41 pm

You mean.. you don't understand what one is? Or you don't understand why you should use them?

Logically, if first condition is met, do the stuff in that if block. Else, if your second condition is met, do the stuff in that block. And so on.
User avatar
Damned_Queen
 
Posts: 3425
Joined: Fri Apr 20, 2007 5:18 pm

Post » Fri May 27, 2011 10:41 am

Meaning every time i use them my script doesnt work :) and that made no sense even though it sounds so obvious...

But im going to attempt here and tell me if this is right

If ( Variable == 0 )set Variable to 1elseif ( variable == 5 )Set Variable to 2elseset variable to 3


Is that right?
User avatar
Roberta Obrien
 
Posts: 3499
Joined: Tue Oct 23, 2007 1:43 pm

Post » Thu May 26, 2011 9:17 pm

Yea, that works. THAT WORKS.
User avatar
Georgia Fullalove
 
Posts: 3390
Joined: Mon Nov 06, 2006 11:48 pm

Post » Thu May 26, 2011 11:54 pm

but... what wrong with the script above... probably some typo
im getting a right eval error message and compiled message. Usually that means i spelled something wrong.
User avatar
Penny Courture
 
Posts: 3438
Joined: Sat Dec 23, 2006 11:59 pm

Post » Fri May 27, 2011 3:03 am

may I suggest you give MWEdit a try? It can help you find the exact error lines
User avatar
Ludivine Poussineau
 
Posts: 3353
Joined: Fri Mar 30, 2007 2:49 pm

Post » Thu May 26, 2011 10:17 pm

You want http://www.uesp.net/wiki/Tes3Mod:GetJournalIndex and not Journal to test for what journal entries the player has.
User avatar
Lexy Corpsey
 
Posts: 3448
Joined: Tue Jun 27, 2006 12:39 am

Post » Fri May 27, 2011 10:33 am

Thank you Jac. I don't understand anything about MWEdit but i will give it a try.
User avatar
Louise
 
Posts: 3407
Joined: Wed Nov 01, 2006 1:06 pm

Post » Thu May 26, 2011 11:08 pm

MWEdit is essentially the construction set for non-graphical editing- meaning there is no render window. Probably one of the best features about it is its syntax highlighting and extensive error checking in scripts.
User avatar
Sophie Louise Edge
 
Posts: 3461
Joined: Sat Oct 21, 2006 7:09 pm

Post » Fri May 27, 2011 6:01 am

Just one FYI, don't use it with dialog. It has a habit of breaking it.
User avatar
RUby DIaz
 
Posts: 3383
Joined: Wed Nov 29, 2006 8:18 am

Post » Thu May 26, 2011 11:24 pm

Thank you.
User avatar
CHANONE
 
Posts: 3377
Joined: Fri Mar 30, 2007 10:04 am

Post » Fri May 27, 2011 2:18 am

but... what wrong with the script above... probably some typo
im getting a right eval error message and compiled message. Usually that means i spelled something wrong.

I could be wrong, but I think you need an endif at the end of that block.
User avatar
Robyn Lena
 
Posts: 3338
Joined: Mon Jan 01, 2007 6:17 am

Post » Fri May 27, 2011 3:49 am

Thank you Jac. I don't understand anything about MWEdit but i will give it a try.


You're welcome. The Journal command is for adding a journal entry to the player's journal. You can also use SetJournalIndex if you want to change the journal index, but not add a new entry. It could be useful for tracking a player's progress in a quest without letting them know you're tracking them. I don't think you need an actual journal entry for that command, but you do for Journal.
User avatar
Brian LeHury
 
Posts: 3416
Joined: Tue May 22, 2007 6:54 am

Post » Fri May 27, 2011 9:36 am

SetJournalIndex doesn't need an index, you're right, Jac. I think it can also be used to go backwards in a quest if need be.

When I was scripting my modTESTchargen mod, MWEdit seemed to corrupt it after a while. The only thing I did in MWEdit for that mod was go straight to the script window and start scripting.. it worked fine for a little while, but after so many saves through MWEdit, the mod just stopped working and I had to copy and paste the scripts into a new mod in the CS in order to continue working. This happened several times.
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Fri May 27, 2011 12:28 pm

Just one FYI, don't use it with dialog. It has a habit of breaking it.
Agreed. MWEdit is fantastic to write & test scripts, to search and cross-reference items, but if you don't need extended commands (no MWSE scripting), when you are sure that your scripts are MWEdit-strict-syntax-approved, it is safer to always copy/paste your perfectly clean scripts from MWEdit to TESCS and recompile them/save your mod from TESCS.
User avatar
Dalton Greynolds
 
Posts: 3476
Joined: Thu Oct 18, 2007 5:12 pm


Return to III - Morrowind