scripting woes

Post » Tue Dec 29, 2009 8:38 pm

MGE's MWSE should be fine. Reference variables not being saved with the game will cause troubles on loading a saved game that still has the npc following you. You might be able to get around this using a write to file function. I tried using one of the write to file functions in one of my scripts, but I failed. I'll have to fiddle with those functions a little more to figure them out.

There is one more thing I want you to try, change to MyCellID>.
User avatar
Dan Scott
 
Posts: 3373
Joined: Sun Nov 11, 2007 3:45 am

Post » Tue Dec 29, 2009 1:44 pm

i was thinking of trying something similar, getting the NPCs id with xgetref, and using THAT on the Setx MyCell to xMyCellId.

i'll give both a shot, shouldent take too long.

edit, when i try your version, i'll do two tests, one with player->mycellid and one with xpccellid

edit again, that was fast. player->mycellid compiles with error -

Syntax Error: Expected 'Unknown' but found 'String' ("player")!


it seems "mycellid does not like "player", both with and without quotes.
User avatar
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am

Post » Tue Dec 29, 2009 3:30 pm

i was thinking of trying something similar, getting the NPCs id with xgetref, and using THAT on the Setx MyCell to xMyCellId.

i'll give both a shot, shouldent take too long.

edit, when i try your version, i'll do two tests, one with player->mycellid and one with xpccellid

edit again, that was fast. player->mycellid compiles with error -



it seems "mycellid does not like "player", both with and without quotes.


The xpccellid function slipped by me. You'll want to go with that.
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Tue Dec 29, 2009 6:42 am

none of the above work.

still the zero point error.

i'm wondering if i'm somehow over 255 compiled commands.

edit, i've commented out the extended functions, but still get the error. this is quite odd. i think my project for tomorrow might be to break the script in two and see if it works then.
User avatar
Kirsty Wood
 
Posts: 3461
Joined: Tue Aug 15, 2006 10:41 am

Post » Tue Dec 29, 2009 9:43 am

none of the above work.

still the zero point error.

i'm wondering if i'm somehow over 255 compiled commands.



It should be 255 commands per block not per script, so that shouldn't be the problem.

if ( gethealth < 1 )        setfight nfight   ; missing "to"        setflee nflee        setalarm nalarm        set varclean to 1endif


I noticed this in the last version of the script you posted, you might have fixed this since then, because I wouldn't have thought this would compile in the editor.
User avatar
Steven Nicholson
 
Posts: 3468
Joined: Mon Jun 18, 2007 1:24 pm

Post » Tue Dec 29, 2009 9:57 pm

setfight setflee and setalarm are like other setstat functions in that you omit the "to". it actually will not compile with the "to".

http://www.uesp.net/wiki/Tes3Mod:SetStat
User avatar
Blackdrak
 
Posts: 3451
Joined: Thu May 17, 2007 11:40 pm

Post » Tue Dec 29, 2009 3:47 pm

Ah, good to know.

And I think you could be right about the 255 command limit. I was thinking 1 line == 1 command, but thats not how it works.
User avatar
Harry-James Payne
 
Posts: 3464
Joined: Wed May 09, 2007 6:58 am

Post » Tue Dec 29, 2009 9:58 pm

i'll leave this question for when i wake up:

if i use a targeted script to start another script, with this script function the same as the first targeted script (meaning that the script is targeted on the same object that the first targeted script) or will it be kind of "foating"?

i'm also kind of iffy on what constitutes a command. is it any function?

and unrelated to all of this, does a "command" spell change the AI package of an NPC?
User avatar
Conor Byrne
 
Posts: 3411
Joined: Wed Jul 11, 2007 3:37 pm

Post » Tue Dec 29, 2009 12:52 pm

update:

this is quite odd. i've deleted the extended functions, yet i still get the "Need more room for zero pointers in script::ReplaceGlobalsInData" error.

and the command question is moot. i forgot NPCs wont activate doors to travel back to their initial position.
User avatar
Adriana Lenzo
 
Posts: 3446
Joined: Tue Apr 03, 2007 1:32 am

Post » Tue Dec 29, 2009 7:15 pm

update, seems i didnt clean thoroughly enough. it seems one of the variables for the extended functions is causing the error. now to track down which.

edit - hrmmmm. DELETING extended functions and associated variables allows the game to load. COMMENTING THEM OUT still returns the error.
User avatar
Amie Mccubbing
 
Posts: 3497
Joined: Thu Aug 31, 2006 11:33 pm

Post » Tue Dec 29, 2009 1:28 pm

I loaded a game with that script and I go the same error.
User avatar
Heather Dawson
 
Posts: 3348
Joined: Sun Oct 15, 2006 4:14 pm

Post » Tue Dec 29, 2009 9:37 am

take it you read the thread i started at GHF? thanks for testing so that i know it's not me.

i'm stupefied as to how i get the error even when everything added is commented out.

i've tried changing variable names, no dice. tis really a stumper.

i'm not giving up yet (i feel i've done a bit too much work to give up) but this is definitely butting my brain through the wringer.
User avatar
Jimmie Allen
 
Posts: 3358
Joined: Sun Oct 14, 2007 6:39 am

Post » Tue Dec 29, 2009 1:25 pm

I took out the xmycellid and the getpos commands with associated variables and I'm still getting the error. What else did you take out to make the game load?
User avatar
Karine laverre
 
Posts: 3439
Joined: Tue Mar 20, 2007 7:50 am

Post » Tue Dec 29, 2009 5:36 am

I took out the xmycellid and the getpos commands with associated variables and I'm still getting the error. What else did you take out to make the game load?

i deleted them totally, commenting does not work.

i also did it in the vanilla CS, not MWedit.



hrmmmmm, could it be that MWedit is somehow screwing up the script?
User avatar
Julie Serebrekoff
 
Posts: 3359
Joined: Sun Dec 24, 2006 4:41 am

Post » Tue Dec 29, 2009 8:33 am

I deleted them too, along with the IFx blocks ( declared variables too). I hope it's not MWEdit.
User avatar
RaeAnne
 
Posts: 3427
Joined: Sat Jun 24, 2006 6:40 pm

Post » Tue Dec 29, 2009 7:40 pm

I created a new esp, and added the edited script. Still got the error. If you still have the version of the script that will load in game, could you post it.
User avatar
Yvonne Gruening
 
Posts: 3503
Joined: Mon Apr 23, 2007 7:31 pm

Post » Tue Dec 29, 2009 11:22 am

Spoiler
begin RAK_tg_kidnappingshort chanceshort oppositionshort initialshort doonceshort currentdayshort varcleanshort oncedoshort threedayshort didonceshort pspeeshort pstrfloat nfightfloat nfleefloat nalarmif ( initial == 0 )	set nfight to ( getfight )	set nflee to ( getflee )	set nalarm to ( getalarm )	set doonce to 0	set varclean to 0	set oncedo to 0	set threeday to 0	set didonce to 0	set opposition to ( ( getspeechcraft ) + random100 )	set pspee to ( "player"->getspeechcraft )	set pstr to ( "player"->getstrength )	set chance to ( pspee + pstr )	set initial to 1	returnendifif ( gethealth < 1 )	setfight nfight	setflee nflee	setalarm nalarm	set varclean to 1endifif ( ( getpccell "Balmora, South Wall Cornerclub" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_ba_ransom to 1	endifelseif ( ( getpccell "Ald-ruhn, The Rat In The Pot" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_ar_ransom to 1	endifelseif ( ( getpccell "Sadrith Mora, Dirty Muriel's Cornerclub" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_sm_ransom to 1	endifelseif ( ( getpccell "Vivec, Simine Fralinie: Bookseller" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_vc_ransom to 1	endifendifif ( RAK_kidnap == 0 )	if ( opposition < chance )		set RAK_kidnap to 1	endifelseif ( RAK_kidnap == 1 )	if ( doonce == 0 )		aifollow "player" 0, 0, 0, 0		setfight 0		setflee 80		set doonce to 1		return	elseif ( doonce == 1 )		if ( ( getdistance "player" ) >= 500 )			set currentday to day			set RAK_kidnap to 2			return		endif	endifelseif ( RAK_kidnap == 2 ) 	if ( oncedo == 0 )		AIWander 5000, 0, 0, 60, 30, 10, 0, 0, 0, 0, 0, 0		set oncedo to 1		return	endif	if ( currentday != day )		set currentday to day		setfight nfight		setflee nflee		setalarm nalarm		set varclean to 1		return	endif	setfight 70	setflee 40elseif ( RAK_kidnap == 3 )	set opposition to ( ( getspeechcraft ) + random100 )	if ( opposition < chance )		set doonce to 0		set RAK_kidnap to 1		return	else		moddisposition -30		set RAK_kidnap to 2		return	endifelseif ( RAK_kidnap == 4 )	if ( didonce == 0 )		forcegreeting 		AIWander 500, 0, 0, 60, 30, 10, 0, 0, 0, 0, 0, 0		set didonce to 1	endif	if ( currentday != day )		set currentday to day		set threeday to ( threeday + 1 )	endifendifif ( threeday > 2 )	set RAK_ransom to ( ( getlevel ) * 100 )	setfight nfight	setflee nflee	setalarm nalarm	set RAK_kidnap to 5	set varclean to 1endifif ( varclean == 1 )	set RAK_kidnap to 0	set doonce to 0	set varclean to 0	set oncedo to 0	set threeday to 0	set didonce to 0	set initial to 0	stopscript "RAK_tg_kidnapping"endifend


i can now confirm, the same script saved from MWedit causes the error, but saved in vanilla CS does not.
User avatar
Mylizards Dot com
 
Posts: 3379
Joined: Fri May 04, 2007 1:59 pm

Post » Tue Dec 29, 2009 2:21 pm

Spoiler
begin RAK_tg_kidnappingshort chanceshort oppositionshort initialshort doonceshort currentdayshort varcleanshort oncedoshort threedayshort didonceshort pspeeshort pstrfloat nfightfloat nfleefloat nalarmif ( initial == 0 )	set nfight to ( getfight )	set nflee to ( getflee )	set nalarm to ( getalarm )	set doonce to 0	set varclean to 0	set oncedo to 0	set threeday to 0	set didonce to 0	set opposition to ( ( getspeechcraft ) + random100 )	set pspee to ( "player"->getspeechcraft )	set pstr to ( "player"->getstrength )	set chance to ( pspee + pstr )	set initial to 1	returnendifif ( gethealth < 1 )	setfight nfight	setflee nflee	setalarm nalarm	set varclean to 1endifif ( ( getpccell "Balmora, South Wall Cornerclub" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_ba_ransom to 1	endifelseif ( ( getpccell "Ald-ruhn, The Rat In The Pot" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_ar_ransom to 1	endifelseif ( ( getpccell "Sadrith Mora, Dirty Muriel's Cornerclub" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_sm_ransom to 1	endifelseif ( ( getpccell "Vivec, Simine Fralinie: Bookseller" ) == 1 )	if ( ( getdistance "player" ) <= 200 )		set RAK_kidnap to 4		set RAK_vc_ransom to 1	endifendifif ( RAK_kidnap == 0 )	if ( opposition < chance )		set RAK_kidnap to 1	endifelseif ( RAK_kidnap == 1 )	if ( doonce == 0 )		aifollow "player" 0, 0, 0, 0		setfight 0		setflee 80		set doonce to 1		return	elseif ( doonce == 1 )		if ( ( getdistance "player" ) >= 500 )			set currentday to day			set RAK_kidnap to 2			return		endif	endifelseif ( RAK_kidnap == 2 ) 	if ( oncedo == 0 )		AIWander 5000, 0, 0, 60, 30, 10, 0, 0, 0, 0, 0, 0		set oncedo to 1		return	endif	if ( currentday != day )		set currentday to day		setfight nfight		setflee nflee		setalarm nalarm		set varclean to 1		return	endif	setfight 70	setflee 40elseif ( RAK_kidnap == 3 )	set opposition to ( ( getspeechcraft ) + random100 )	if ( opposition < chance )		set doonce to 0		set RAK_kidnap to 1		return	else		moddisposition -30		set RAK_kidnap to 2		return	endifelseif ( RAK_kidnap == 4 )	if ( didonce == 0 )		forcegreeting 		AIWander 500, 0, 0, 60, 30, 10, 0, 0, 0, 0, 0, 0		set didonce to 1	endif	if ( currentday != day )		set currentday to day		set threeday to ( threeday + 1 )	endifendifif ( threeday > 2 )	set RAK_ransom to ( ( getlevel ) * 100 )	setfight nfight	setflee nflee	setalarm nalarm	set RAK_kidnap to 5	set varclean to 1endifif ( varclean == 1 )	set RAK_kidnap to 0	set doonce to 0	set varclean to 0	set oncedo to 0	set threeday to 0	set didonce to 0	set initial to 0	stopscript "RAK_tg_kidnapping"endifend


i can now confirm, the same script saved from MWedit causes the error, but saved in vanilla CS does not.


Try unquoting the "player" references. MWEdit doesn't seem to like them, and compiles it wrong. I don't know why, but I do remember fiddling with quotes seemed to fix it when I had the same error a little while ago in one of my own scripts. So,

aifollow player 0, 0, 0, 0
instead.
User avatar
Laura Simmonds
 
Posts: 3435
Joined: Wed Aug 16, 2006 10:27 pm

Post » Tue Dec 29, 2009 5:41 pm

well, that did get rid of the zero pointers error, but it also caused the script to not function (including the extended functions)

quick question (that will save me a lot of time) will getpccell still function without quotes around the cell name? the spaces in cell names makes me think no, and that it'll only run off of the first word (and return true for partial matches, which is a nogo in this situation)
User avatar
No Name
 
Posts: 3456
Joined: Mon Dec 03, 2007 2:30 am

Post » Tue Dec 29, 2009 6:47 pm

Im wondering If you need to set the npc's Id to a variable to use some the mwse functions.

EDIT: MWEdit won't even compile the getpccell without quotes
User avatar
Dylan Markese
 
Posts: 3513
Joined: Sat Dec 01, 2007 11:58 am

Post » Tue Dec 29, 2009 6:42 am

Im wondering If you need to set the npc's Id to a variable to use some the mwse functions.

EDIT: MWEdit won't even compile the getpccell without quotes

heh, i dont know what i was thinking when i asked, bungadunga specifically said "player" references, cellnames should be fine. but without the quotes, the getdistance checks never fired. this is fine though, because i'm removing the getdistance checks, they are redundant.

i'm going to test a new version real quick, one with a few refinements, and return.... should take 10 mins or less.
User avatar
Robert Bindley
 
Posts: 3474
Joined: Fri Aug 03, 2007 5:31 pm

Post » Tue Dec 29, 2009 12:09 pm

I wonder if you have too many () marks in some of your script like

if ( ( getdistance player ) <= 200 )

I usualy see it like this

If ( GetDistance, Player <= 200 )

I noticed this in a few instances in your script not just this getDIstance part. I'm not sure if it can cause errors or not.
User avatar
Da Missz
 
Posts: 3438
Joined: Fri Mar 30, 2007 4:42 pm

Post » Tue Dec 29, 2009 7:33 am

heh, i dont know what i was thinking when i asked, bungadunga specifically said "player" references, cellnames should be fine. but without the quotes, the getdistance checks never fired. this is fine though, because i'm removing the getdistance checks, they are redundant.

i'm going to test a new version real quick, one with a few refinements, and return.... should take 10 mins or less.

My guess is the problem would happen with other actor and activator references, but I had the problem specifically with the player. I would imagine GetDistance should fire (try MessageBoxing their output) but don't bother if they're not needed.

I tend to err on the side of too many parenthesis, rather than too few. I don't trust Morrowind to get it right. Mind you, the assumption that the game/compiler/extender/hardware/cosmic ray will find some way to break an otherwise perfectly good script is probably the single most important requirement for Morrowind programming.
User avatar
^~LIL B0NE5~^
 
Posts: 3449
Joined: Wed Oct 31, 2007 12:38 pm

Post » Tue Dec 29, 2009 6:58 am

ive been told or read that wrapping functions in extra brackets in conditionals is preferred. at least one of my other scripts will not function correctly if i remove them.

the script runs, marginally. rak_kidnap 4 does not seem to function though. the didonce conditional does not fire. i also can not get the NPC to react as if the player preformed a negative act upon it. how can i force this without a startcombat, which i assume would cause the guards to attack the NPC, and the PC would gain no additional bounty for striking back.

other than that, everything SEEMS to be working correctly, though i havent had a chance to thoroughly test every possible situation.
User avatar
Vincent Joe
 
Posts: 3370
Joined: Wed Sep 26, 2007 1:13 pm

Post » Tue Dec 29, 2009 4:06 pm

if ( threeday > 2 )        set RAK_ransom to ( ( getlevel ) * 100 )        setfight nfight        setflee nflee        setalarm nalarm        set RAK_kidnap to 5        set varclean to 1        return     ;<-------- need a return here to go back up to the NPC teleport, before the last If block runs (cleanup block with the stopscript)endif


I'm glad you've had some progress, If you need a tester, I can help you out there.
User avatar
Stace
 
Posts: 3455
Joined: Sun Jun 18, 2006 2:52 pm

PreviousNext

Return to III - Morrowind