Merge Two Scripts - Help!

Post » Tue May 17, 2011 11:02 am

Hi, I have two mods that I want to work together but I don't know anything about scripting to be able to do it.
I use Simple Needs 4.5 (http://www.fallout3nexus.com/downloads/file.php?id=3769) by trebtreb and want to merge the playerbed script from it with the bed from Portable Camp (http://www.fallout3nexus.com/downloads/file.php?id=2356) by diernayr so that I get the sleep benefits of using a dropped cot.

Here is the script from Simple Needs:

scn PlayerBedSCRIPT

short playerSleep

begin onactivate
if isActionRef player == 1
; set playerBed ref variable to me
set playerSleep to 1
endif
Activate
end

begin menumode
; player has activated me and is sleeping
if playerSleep == 1 && IsPCSleeping == 1
set playerSleep to 2
endif
end

begin gamemode
if playerSleep > 0
if playerSleep == 2
; player has actually slept in this bed
; give player Well-Rested spell and then clear variable
player.CastImmediateOnSelf WellRestedSpell
;=======================================
if ( Player.IsSpellTarget SimpleNeedsSleep == 1 )
Player.RemoveSpell SimpleNeedsSleep
ShowMessage SimpleNeedsFatigueOFFMESG
EndIf
Set SimpleNeedsSleepQuest.SleepVar to 100
set SimpleNeedsSleepQuest.LastSleepDay to GameDaysPassed
;=======================================
endif
; clear variable
set playerSleep to 0
endif
end


And here is the one from Portable Camp:

scn aapsbedscript2

begin onactivate
if player.issneaking == 1
player.additem "aapsbedbook" 1
disable
markfordelete
else
activate
endif
end

Any help would truly be welcome. I think that the Simple Needs script needs to be part of the Portable Camp script, but I'm not sure.

Thank you in advance for your assistance.
User avatar
-__^
 
Posts: 3420
Joined: Mon Nov 20, 2006 4:48 pm

Post » Tue May 17, 2011 3:22 am

Before you do a thing -- have you asked the original two modders if their okay with it?
User avatar
Peter P Canning
 
Posts: 3531
Joined: Tue May 22, 2007 2:44 am

Post » Tue May 17, 2011 2:42 am

Before you do a thing -- have you asked the original two modders if their okay with it?


If it's for his own personal use, he doesn't need to.
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Tue May 17, 2011 12:40 pm

If it's for his own personal use, he doesn't need to.



This is strictly for myself. I just want the benefits from the one mod to be useful in another.
User avatar
Taylah Haines
 
Posts: 3439
Joined: Tue Feb 13, 2007 3:10 am

Post » Tue May 17, 2011 11:56 am

No help? That kinda svcks.
User avatar
Agnieszka Bak
 
Posts: 3540
Joined: Fri Jun 16, 2006 4:15 pm

Post » Tue May 17, 2011 4:08 am

scn aapsbedscript2

short playerSleep

begin onactivate
if isActionRef player == 1 && Player.IsSneaking == 0
; set playerBed ref variable to me
set playerSleep to 1
Activate
endIf

if player.issneaking == 1
player.additem "aapsbedbook" 1
disable
markfordelete
endIf
end

begin menumode
; player has activated me and is sleeping
if playerSleep == 1 && IsPCSleeping == 1
set playerSleep to 2
endif
end

begin gamemode
if playerSleep > 0
if playerSleep == 2
; player has actually slept in this bed
; give player Well-Rested spell and then clear variable
player.CastImmediateOnSelf WellRestedSpell
;=======================================
if ( Player.IsSpellTarget SimpleNeedsSleep == 1 )
Player.RemoveSpell SimpleNeedsSleep
ShowMessage SimpleNeedsFatigueOFFMESG
EndIf
Set SimpleNeedsSleepQuest.SleepVar to 100
set SimpleNeedsSleepQuest.LastSleepDay to GameDaysPassed
;=======================================
endif
; clear variable
set playerSleep to 0
endif
end


This should work. Always test it though.
User avatar
Kayleigh Mcneil
 
Posts: 3352
Joined: Thu Jun 29, 2006 7:32 am

Post » Tue May 17, 2011 1:15 am

Thanks Harmy52. I will try it right away and let you know if it did indeed work.
User avatar
Darrell Fawcett
 
Posts: 3336
Joined: Tue May 22, 2007 12:16 am

Post » Tue May 17, 2011 6:56 am

I keep getting 2 errors:

SCRIPTS: Script 'aapsbedscript2', line 37:
Unknown variable or function 'SleepVar'.

and

SCRIPTS: Script 'aapsbedscript2', line 37:
Missing variable name in set command.

I tried adding any scripts that had SleepVar in them to the Portable Camp's esp hoping that would solve it but alas I am far and away lost. The script seems to be exact to the original, as far as I can tell, so I am not sure what is missing that is making this error occur.

I tried using the Plugin Editor from FOMM 0.9? to shoehorn the script into the esp and the benefits of sleeping on the portable bed are not working. I wake up still fatigued.
User avatar
Motionsharp
 
Posts: 3437
Joined: Sun Aug 06, 2006 1:33 am

Post » Tue May 17, 2011 4:29 pm

Ah. It's a little more complicated then. You would need to merge the bed mod into the RS mod. I'm afraid I can't help you with that.
User avatar
Kelvin Diaz
 
Posts: 3214
Joined: Mon May 14, 2007 5:16 pm

Post » Tue May 17, 2011 4:53 pm

Okay then I will just try that and let you know if it works.
User avatar
BEl J
 
Posts: 3397
Joined: Tue Feb 13, 2007 8:12 am

Post » Tue May 17, 2011 3:28 am

Harmy52: I have tried it both ways merging the bed into needs and the needs into the bed mod and neither seems to do anything. Thanks for at least giving it a shot.
User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Tue May 17, 2011 1:11 pm

Well I'm not sure if you can copy scripts just like any other text files, but if so you could copy both scripts into a couple of Notepad files, then use WinMerge to join them together into a new combined script. Then just copy that one back into the mod you want to use it with. I've never tried to copy/paste a GECK script so I don't know if it's possible. As for WinMerge, if you've never heard of it it's quite a handy utility. Just Google it and you'll find it. And it's free.
User avatar
Steve Bates
 
Posts: 3447
Joined: Sun Aug 26, 2007 2:51 pm

Post » Tue May 17, 2011 8:01 am

Hopefully you are using the simple needs esp as your starting point. It looks like that one has quests and etc, which would not be copied over with any simple script merge. The portable bed script looks like it has is adding/removing some item. Does this item exist in simple needs? If not you need to recreate it.

A more simple approach might be in order. Have you tried loading both esps and seeing how it conflicts? Depending on how they it works out, you may find the result tolerable.
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Tue May 17, 2011 8:17 am

Belanos: Tried WinMerge couldn't figure it out. As far as I could tell it wanted me to replace different sections instead of amalgamating them together.

Makviel: Not to sound rude but if the Portable Camp mod bed was in the Simple Needs mod I wouldn't need to merge the two scripts so that I can fold up and pop out the bed as it works in Portable Camp, as well as get the benefits from Simple Needs Sleep. As to your simple approach I don't understand how the load order of two totally unrelated mods and their unrelated scripts is going to make a difference. It is not a question of conflicting with each other it is a question of getting them to work together in harmony. When I sleep in the bed from Portable Camp the script in Simple Needs doesn't go "Look he slept in a bed therefore he is well rested" Instead my fatigue goes to zero and I am tired. Again I am sorry if I sound rude it is not my intention.
User avatar
Raymond J. Ramirez
 
Posts: 3390
Joined: Sun Oct 14, 2007 8:28 am

Post » Tue May 17, 2011 9:19 am

Belanos: Tried WinMerge couldn't figure it out. As far as I could tell it wanted me to replace different sections instead of amalgamating them together.


What's not to figure out? You're copying parts of one script into another. Just make a copy of one of them, merge the parts of the other that you want to include, then save the merged script when you're done. The only issue you might have is if the two scripts have similar lines. But then you just decide which one you'd rather have.
User avatar
Kim Kay
 
Posts: 3427
Joined: Fri Oct 13, 2006 10:45 am

Post » Tue May 17, 2011 2:44 pm

Belanos: If it is a matter of just copying one script into the other script then why do I need a program to do that for me. I can cut and paste it myself. But I tried that and it didn't work.
User avatar
lolli
 
Posts: 3485
Joined: Mon Jan 01, 2007 10:42 am

Post » Tue May 17, 2011 3:11 am

When posting code, use [code] tags to keep the formatting. Unindented code is a bugger to read. Repost both using it.
User avatar
Assumptah George
 
Posts: 3373
Joined: Wed Sep 13, 2006 9:43 am

Post » Tue May 17, 2011 11:40 am

When posting code, use [code] tags to keep the formatting. Unindented code is a bugger to read. Repost both using it.



What is a code tag? I've never posted code before so I don't know. I copied both of those from the GECK.
User avatar
Sarah Kim
 
Posts: 3407
Joined: Tue Aug 29, 2006 2:24 pm

Post » Tue May 17, 2011 2:09 am

...[code]. Like [quote].
User avatar
stevie critchley
 
Posts: 3404
Joined: Sat Oct 28, 2006 4:36 pm

Post » Tue May 17, 2011 11:36 am

[quote name='TheTalkieToaster' date='10 June 2010 - 09:04 PM' timestamp='1276218247' post='16029353']
...[code]. Like [quote].
[/quote]

I'm sorry I must be severly disabled in the brain because that makes no sense to me whatever. Am I supposed to quote you the code? How do I do that?
User avatar
Chloe :)
 
Posts: 3386
Joined: Tue Jun 13, 2006 10:00 am

Post » Tue May 17, 2011 2:00 am

No, you put the scripts inside {code} script {/code} tags. But replace the {} with []
User avatar
Ashley Campos
 
Posts: 3415
Joined: Fri Sep 22, 2006 9:03 pm

Post » Tue May 17, 2011 10:21 am

Oh okay I didn't know that. Thanks.

 scn PlayerBedSCRIPTshort playerSleepbegin onactivateif isActionRef player == 1; set playerBed ref variable to meset playerSleep to 1endifActivateendbegin menumode; player has activated me and is sleepingif playerSleep == 1 && IsPCSleeping == 1set playerSleep to 2endifendbegin gamemodeif playerSleep > 0if playerSleep == 2; player has actually slept in this bed; give player Well-Rested spell and then clear variableplayer.CastImmediateOnSelf WellRestedSpell;=======================================if ( Player.IsSpellTarget SimpleNeedsSleep == 1 )Player.RemoveSpell SimpleNeedsSleepShowMessage SimpleNeedsFatigueOFFMESGEndIfSet SimpleNeedsSleepQuest.SleepVar to 100set SimpleNeedsSleepQuest.LastSleepDay to GameDaysPassed;=======================================endif; clear variableset playerSleep to 0endifend 


 scn aapsbedscript2begin onactivateif player.issneaking == 1player.additem "aapsbedbook" 1disablemarkfordeleteelseactivateendifend 

User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Tue May 17, 2011 3:17 pm

How did that help?
User avatar
John N
 
Posts: 3458
Joined: Sun Aug 26, 2007 5:11 pm


Return to Fallout 3