Script Query

Post » Mon Jun 13, 2011 3:54 pm

Okay. I had someone write me this script a while ago, but they aren't around anymore and I can't get it to work. Anyone see the problem?


begin NC_WeatherPanel

short OnActivate
short button
short state

If ( onActivate == 1 )
set state to 1
set onActivate to 0
endif

if ( state == 0 )
return
endif

if ( state == 1 )
MessageBox "You see several buttons: which one do you press?" "Clear" "Cloudy" "Foggy" "Overcast" "Rain" "Thunder" "Ash" "Blight" "Normal"
set state to 2
endif

if ( state == 2 )
set button to getbuttonpressed
if ( button == 0 )
MessageBox "The sun shines brightly in the sky."
ModRegion, "Niemarkh Region", 100, 0, 0, 0, 0, 0, 0, 0
set state to 0
endif
if (button == 1)
MessageBox "Clouds begin to roll in…"
ModRegion, "Niemarkh Region", 0, 100, 0, 0, 0, 0, 0, 0
set state to 0
endif
if (button == 2)
MessageBox "A dense fog creeps along the ground."
ModRegion, "Niemarkh Region", 0, 0, 100, 0, 0, 0, 0, 0
set state to 0
endif
if (button == 3)
MessageBox "The skies run thick with clouds."
ModRegion, "Niemarkh Region", 0, 0, 0, 100, 0, 0, 0, 0\
set state to 0
endif
if (button == 4)
MessageBox "Rain begins to fall from the sky."
ModRegion, "Niemarkh Region", 0, 0, 0, 0, 100, 0, 0, 0
set state to 0
endif
if (button == 5)
MessageBox "Lightning and thunder rend the heavens."
ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 100, 0, 0
set state to 0
endif
if (button == 6)
MessageBox "Ash scours the island."
ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 0, 100, 0
set state to 0
endif
if (button == 7)
MessageBox "A poisonous blight ravages the island."
ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 0, 0, 100
set state to 0
endif
if (button == 8)
MessageBox "The weather returns to normal."
ModRegion, "Niemarkh Region", 25, 35, 5, 20, 10, 5, 0, 0
set state to 0
endif
endif
end

User avatar
Carlitos Avila
 
Posts: 3438
Joined: Fri Sep 21, 2007 3:05 pm

Post » Mon Jun 13, 2011 8:56 pm

if (button == 3)
MessageBox "The skies run thick with clouds."
ModRegion, "Niemarkh Region", 0, 0, 0, 100, 0, 0, 0, 0\
set state to 0
endif


Quick note: you have a \ there that I'm sure shouldn't be...
It also looks like you have an extra endif at the end as well...

One thing I'm trying to learn is scripting, so I don't know about about this, but those were just two things I think could be wrong. I'm sure someone more knowledgeable will wander into this thread soon ;)
User avatar
James Wilson
 
Posts: 3457
Joined: Mon Nov 12, 2007 12:51 pm

Post » Mon Jun 13, 2011 1:26 pm

Untested, but try this:

begin NC_WeatherPanelshort OnActivateshort buttonshort stateIf ( onActivate == 1 )	set state to 1	set onActivate to 0endifif ( state == 0 )	returnendifif ( state == 1 )	MessageBox "You see several buttons: which one do you press?" "Clear" "Cloudy" "Foggy" "Overcast" "Rain" "Thunder" "Ash" "Blight" "Normal"	set state to 2endifif ( state == 2 )	set button to getbuttonpressed		if ( button == -1 )			return		elseif ( button == 0 )			MessageBox "The sun shines brightly in the sky."			ModRegion, "Niemarkh Region", 100, 0, 0, 0, 0, 0, 0, 0			set state to 0			return		elseif ( button == 1 )			MessageBox "Clouds begin to roll in…"			ModRegion, "Niemarkh Region", 0, 100, 0, 0, 0, 0, 0, 0			set state to 0			return		elseif ( button == 2 )			MessageBox "A dense fog creeps along the ground."			ModRegion, "Niemarkh Region", 0, 0, 100, 0, 0, 0, 0, 0			set state to 0			return		elseif ( button == 3 )			MessageBox "The skies run thick with clouds."			ModRegion, "Niemarkh Region", 0, 0, 0, 100, 0, 0, 0, 0			set state to 0			return		elseif ( button == 4 )			MessageBox "Rain begins to fall from the sky."			ModRegion, "Niemarkh Region", 0, 0, 0, 0, 100, 0, 0, 0			set state to 0			return		elseif ( button == 5 )			MessageBox "Lightning and thunder rend the heavens."			ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 100, 0, 0			set state to 0			return		elseif ( button == 6 )			MessageBox "Ash scours the island."			ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 0, 100, 0			set state to 0			return		elseif ( button == 7 )			MessageBox "A poisonous blight ravages the island."			ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 0, 0, 100			set state to 0			return		elseif ( button == 8 )			MessageBox "The weather returns to normal."			ModRegion, "Niemarkh Region", 25, 35, 5, 20, 10, 5, 0, 0			set state to 0			return		 endifendifend

User avatar
Jesus Sanchez
 
Posts: 3455
Joined: Sun Oct 21, 2007 11:15 am

Post » Mon Jun 13, 2011 10:02 am

Thanks Jac.Testing now.
User avatar
James Shaw
 
Posts: 3399
Joined: Sun Jul 08, 2007 11:23 pm

Post » Mon Jun 13, 2011 12:27 pm

Jac, the script did not work for some reason...
User avatar
Lizs
 
Posts: 3497
Joined: Mon Jul 17, 2006 11:45 pm

Post » Mon Jun 13, 2011 5:36 pm

Try this and please tell me exactly what it's doing and what you're doing. Thanks.

begin NC_WeatherPanelshort buttonshort stateIf ( OnActivate == 1 )        set state to 1        returnendifif ( state == 0 )        returnendifif ( state == 1 )        MessageBox "You see several buttons: which one do you press?" "Clear" "Cloudy" "Foggy" "Overcast" "Rain" "Thunder" "Ash" "Blight" "Normal"        set state to 2endifif ( state == 2 )        set button to getbuttonpressed                if ( button == -1 )                        return                elseif ( button == 0 )                        MessageBox "The sun shines brightly in the sky."                        ModRegion, "Niemarkh Region", 100, 0, 0, 0, 0, 0, 0, 0                        set state to 0                        return                elseif ( button == 1 )                        MessageBox "Clouds begin to roll in…"                        ModRegion, "Niemarkh Region", 0, 100, 0, 0, 0, 0, 0, 0                        set state to 0                        return                elseif ( button == 2 )                        MessageBox "A dense fog creeps along the ground."                        ModRegion, "Niemarkh Region", 0, 0, 100, 0, 0, 0, 0, 0                        set state to 0                        return                elseif ( button == 3 )                        MessageBox "The skies run thick with clouds."                        ModRegion, "Niemarkh Region", 0, 0, 0, 100, 0, 0, 0, 0                        set state to 0                        return                elseif ( button == 4 )                        MessageBox "Rain begins to fall from the sky."                        ModRegion, "Niemarkh Region", 0, 0, 0, 0, 100, 0, 0, 0                        set state to 0                        return                elseif ( button == 5 )                        MessageBox "Lightning and thunder rend the heavens."                        ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 100, 0, 0                        set state to 0                        return                elseif ( button == 6 )                        MessageBox "Ash scours the island."                        ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 0, 100, 0                        set state to 0                        return                elseif ( button == 7 )                        MessageBox "A poisonous blight ravages the island."                        ModRegion, "Niemarkh Region", 0, 0, 0, 0, 0, 0, 0, 100                        set state to 0                        return                elseif ( button == 8 )                        MessageBox "The weather returns to normal."                        ModRegion, "Niemarkh Region", 25, 35, 5, 20, 10, 5, 0, 0                        set state to 0                        return                 endifendifend

User avatar
WYatt REed
 
Posts: 3409
Joined: Mon Jun 18, 2007 3:06 pm

Post » Mon Jun 13, 2011 11:02 pm

This time, when I entered the cell (hadn't done this before" it told me that there was an error in the script; something about EXPRESSIONS. It then gave me a second popup saying "Right eval".

Normally, both with my script and your prior one, all that happens when I activate it is.. nothing. the words "Control Panel" flash once to show I hit the spacebar, but nothing else happens... :banghead:
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Mon Jun 13, 2011 7:37 pm

I'm not certain if this is your answer or not, but... the original script and all those following have only 8 slots for weather. If you have Bloodmoon, there are 10 weather options, adding snow and blizzard. If any of those button options have any possibility of those two, it will break the script because the total must be an exact 100. Since your script adds a 100% possibility of whatever weather, any additional will mess things up.
User avatar
Leonie Connor
 
Posts: 3434
Joined: Mon Mar 12, 2007 4:18 pm

Post » Mon Jun 13, 2011 8:40 am

There is no Niemarkh Region in the game. Is that a region that's included in your mod? If it's not there, then that script won't work.
User avatar
hannaH
 
Posts: 3513
Joined: Tue Aug 15, 2006 4:50 am

Post » Mon Jun 13, 2011 10:17 am

It is a region I added to the mod. It is located from cell -19, 19 through -21, 21 at the moment (and if I ever get %&!#$?ing Tesfaith working it'll be moved).
User avatar
DAVId Bryant
 
Posts: 3366
Joined: Wed Nov 14, 2007 11:41 pm


Return to III - Morrowind