How to use a script variable from another script

Post » Wed Dec 30, 2009 6:28 am

Hi folks, I have this bit of code:

	set recallme to zzzbackpackrecallscript.recallme	if ( recallme )		set recallme to 0		set zzzbackpackrecallscript.recallme to 0		backpackref.moveto player	endif


And I am getting erros on the "set" command line. zzzbackpackrecallscript exists, and is saved, along with the plugin..... That part is in place. However, when I try to compile this script, I get two errors.

First: I get "unknown variable or function 'recallme'

Second: Is a syntax error for set command.

what am I doing wrong here, and secondly, can I set a variable in another script, from this one?
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Wed Dec 30, 2009 1:50 am

Um is that other script a quest script and attached to an active quest? You have to use the questname instead of the scriptname. Set variable to questname.othervariable :) Variables and references from other scripts can't be used if they are not quest scripts.
User avatar
Jessie Rae Brouillette
 
Posts: 3469
Joined: Mon Dec 11, 2006 9:50 am

Post » Wed Dec 30, 2009 9:01 am

Its an object script, attached to a ring. I take it it isn't going to be that easy huh?
User avatar
Shirley BEltran
 
Posts: 3450
Joined: Wed Jul 26, 2006 4:14 pm

Post » Wed Dec 30, 2009 8:45 am

Its an object script, attached to a ring. I take it it isn't going to be that easy huh?


Well you can make a separate quest script with shared variables between the two scripts. Object scripts can change variables in quest scripts.
User avatar
Katie Pollard
 
Posts: 3460
Joined: Thu Nov 09, 2006 11:23 pm

Post » Wed Dec 30, 2009 6:45 am

That sounds like a better plan. Will give that a shot.
User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Wed Dec 30, 2009 12:26 am

Ok, fixed the first problem, now, on to the next.......

	if (zzzbackpackquest.recallme == 1)		printc "recall is 1"		if (player.getitemcount backpackref == 0)			printc "moving backpack"			set zzzbackpackquest.recallme to 0			backpackgroundref.moveto player, 256,0,20		endif	endif


both if loops print their messages to the console.... so, they ARE executing, however...... the backpack never moves.... There is an ondrop block that sets backpackgroundref to getself, when you boot the backpack out of inventory.

What am I missing here??
User avatar
Phillip Hamilton
 
Posts: 3457
Joined: Wed Oct 10, 2007 3:07 pm

Post » Tue Dec 29, 2009 7:30 pm

Object art and collision fails to move correctly with a moveTo call. Try disabling the backpack first, call moveTo and finally reenable it.
User avatar
Sammygirl
 
Posts: 3378
Joined: Fri Jun 16, 2006 6:15 pm

Post » Wed Dec 30, 2009 6:03 am

Thanks ShadeMe. That is exactly what I had to do. (and not do all three in the same frame either.....) although, MoveTo was kinda random in its positioning, so, had to address that as well. It seems to be dialed in now, and just awaits some further testing to verify that it is all reliable.
User avatar
Skivs
 
Posts: 3550
Joined: Sat Dec 01, 2007 10:06 pm


Return to IV - Oblivion