Can't use quest variable in another quest script?

Post » Wed Sep 07, 2011 7:11 pm

I am trying get the following script to work:

scn aaarecyclemanyshort itemcountshort quantityshort buttonshort stagefloat totalvaluefloat valueref itemBegin gamemode		printc "Recycling Script Running." 		if ( stage == 0 )		amrecyclingchest.disable		amrecyclingchest.moveto player 256 0 0		amrecyclingchest.enable		set stage to 2		amrecyclingchest.activate player	endif		if ( stage == 2 )		let itemcount := amrecyclingchest.getnumitems - 1		while ( itemcount >= 0 )			let item := amrecyclingchest.getinventoryobject itemcount			let value := amrecyclingchest.GetFullGoldValue item			let quantity := amrecyclingchest.getitemcount item			set value to value * quantity			set totalvalue to totalvalue + value			set itemcount to itemcount - 1		loop		set stage to 3	endif		if ( stage == 3 )				if ( button == 0 )			set totalvalue to ( totalvalue * aaaAdvancedMagecraftQST.RecycleGoldCost )			messagebox "Recycle items for %.0f Gold?" totalvalue "Yes" "Cancel"			set button to -1		endif				if ( button == -1 )			set button to getbuttonpressed		endif				printc "button %0.f" button		if ( button == 0 )			printc "button 0"			amrecyclingchest.removeallitems			amrecyclingchest.disable			amrecyclingchest.positioncell 0 0 0 0  aaaadvancedmagecraftholdingcell			amrecyclingchest.enable			player.additem gold001 totalvalue			set stage to 0			return		endif		if ( button == 1 )			printc "button 1"			amrecyclingchest.removeallitems player			amrecyclingchest.disable			amrecyclingchest.positioncell 0 0 0 0  aaaadvancedmagecraftholdingcell			amrecyclingchest.enable			set stage to 0			set button to 0			return		endif		endif		stopquest aaaAMRecyclingQuest	end		


Seems the compiler doesn't like aaaAdvancedMagecraftQST.RecycleGoldCost in this script though, keeps telling me "unknown variable of function? Worked fine till I converted this to a quest script. What am I missing here??
User avatar
Guinevere Wood
 
Posts: 3368
Joined: Mon Dec 04, 2006 3:06 pm

Post » Wed Sep 07, 2011 7:11 am

Seems the compiler doesn't like aaaAdvancedMagecraftQST.RecycleGoldCost in this script though, keeps telling me "unknown variable of function? Worked fine till I converted this to a quest script. What am I missing here??
For this to work, you need a quest named aaaAdvancedMagecraftQST in this same mod. This quest must have a quest script attached, with a variable named RecycleGoldCost, but the name of the script doesn't matter.

Are all this true? If it is, then the variable should definitely be know.
User avatar
Paula Rose
 
Posts: 3305
Joined: Fri Feb 16, 2007 8:12 am

Post » Wed Sep 07, 2011 3:18 pm

For this to work, you need a quest named aaaAdvancedMagecraftQST in this same mod. This quest must have a quest script attached, with a variable named RecycleGoldCost, but the name of the script doesn't matter.

Are all this true? If it is, then the variable should definitely be know.


See, that's what throws me for a loop. The script worked (for the most part...... the "executes once" thing renedered the messagebox useless.....) until i changed it to a quest script. Then, it didn't like ANY of the variables that worked just fine when it was an object script. (called function.)
User avatar
Zosia Cetnar
 
Posts: 3476
Joined: Thu Aug 03, 2006 6:35 am

Post » Wed Sep 07, 2011 8:25 am

DOH!!!!!!

Found the problem..... i set this script to the quest script for the WRONG QUEST. Fixed that, compiles nicely now...... Yep, if you look in the encyclopedia under "unobservant", you will find a picture of me......
User avatar
Cathrin Hummel
 
Posts: 3399
Joined: Mon Apr 16, 2007 7:16 pm

Post » Wed Sep 07, 2011 9:17 am

Using a Global variable removes the 'quest name prefix' needed in the variable names. Just saying...
Global variables are also more effecient since the Quest overhead is not needed.
User avatar
patricia kris
 
Posts: 3348
Joined: Tue Feb 13, 2007 5:49 am

Post » Wed Sep 07, 2011 3:12 pm

Using a Global variable removes the 'quest name prefix' needed in the variable names. Just saying...
Global variables are also more effecient since the Quest overhead is not needed.


Yeah, I notice that there is a significant delay between hitting the hotkey, and the container actually showing up.... (15 to 30 seconds on my machine......) I have other menu's that are called directly from hotkeys, that show up almost instantly. Currently, I have it working, but, the delay's between various steps are fairly significant. I may have to find another method......
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm


Return to IV - Oblivion