Jump to content

Help With Script


Recommended Posts

Ok, So as the title says I need a little help with this script... Basically, I am trying to spawn items, but have it cost items for doing so. So when the object is spawned, it will take that item from you. Compiles fine, Loads and runs fine, Never takes the item. Maybe I'm too tired and just missing something small, Sooooooooo if anyone wants to chime in and tell me what I'm missing feel free:

 

 

.variableTable
.variable ::Caps_var MiscObject
.constFlag 0
.userFlags 0
.initialValue None
.endVariable

 

 

------------

 

 

.propertyTable
.property MessageVertibird message auto
.userFlags 0
.docString ""
.autoVar ::MessageVertibird_var
.endProperty
.property Caps MiscObject auto
.userFlags 0
.docString ""
.autoVar ::Caps_var
.endProperty

 

------------

 

 

.localTable
.local ::temp1 Int
.local ::temp2 Bool
.local ::temp3 Int
.local ::temp4 Bool
.local ::temp5 Bool
.local ::temp8 Bool
.local ::temp9 Bool
.local ::temp12 Bool
.local ::temp13 Bool
.local ::temp16 Bool
.local ::temp6 form
.local ::temp7 ObjectReference
.local ::temp10 form
.local ::temp11 ObjectReference
.local ::temp14 form
.local ::temp15 ObjectReference
.local ::temp17 Int
.local ::temp24 Bool
.local ::temp18 form
.local ::temp19 ObjectReference
.local ::temp20 form
.local ::temp21 ObjectReference
.local ::temp22 form
.local ::temp23 ObjectReference
.local ::temp25 Bool
.local ::temp28 Bool
.local ::temp29 Bool
.local ::temp32 Bool
.local ::temp33 Bool
.local ::temp36 Bool
.local ::temp26 form
.local ::temp27 ObjectReference
.local ::temp30 form
.local ::temp31 ObjectReference
.local ::temp34 form
.local ::temp35 ObjectReference
.local ::temp37 Int
.local ::temp38 form
.local ::temp39 ObjectReference
.local ::temp40 form
.local ::temp41 MiscObject
.local PlayerREF actor
.local ::nonevar None
.endLocalTable

 

-----

 

 

label17:
COMPAREEQ ::temp25 aiButton 3 ;@line 119
JUMPF ::temp25 label9 ;@line 119
CALLMETHOD Show ::MessageVertibird_var ::temp37 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ;@line 120
ASSIGN aiButton ::temp37 ;@line 120
COMPAREEQ ::temp28 aiButton 0 ;@line 121
JUMPF ::temp28 label24 ;@line 121
CAST ::temp38 ::VDEF_var ;@line 122
CALLMETHOD PlaceAtMe ::Player_var ::temp39 ::temp38 1 False False True ;@line 122
CALLMETHOD RemoveItem PlayerREF ::Caps_var ::temp40 ::temp41 1000 True ;@line 122
JUMP label25 ;@line 122
label24:
COMPAREEQ ::temp29 aiButton 1 ;@line 123
JUMPF ::temp29 label25 ;@line 123
CAST ::temp38 ::MFTV_var ;@line 124
CALLMETHOD PlaceAtMe ::Player_var ::temp39 ::temp38 1 False False True ;@line 124
CALLMETHOD RemoveItem PlayerREF ::Caps_var ::temp40 ::temp41 1000 True ;@line 124
JUMP label25 ;@line 124
label25:
JUMP label9 ;@line 124
label9:
JUMP label1 ;@line 124
label1:
JUMP label26 ;@line 124
label0:
.endCode

Edited by Karel2015
Link to comment
Share on other sites

1. Don't write in Papyrus Assembly.

2. Don't post Papyrus Assembly when asking for help. Post the Papyrus source code.

3. Please remember Rule #1 and Rule #2.

 

In short, if you wrote your script in Papyrus Assembly, rewrite it in Papyrus source code. And if you didn't write your script in Papyrus Assembly, post the Papyrus source code instead of the assembly code. Otherwise, few, aside from an Assembly programmer, are going to be able to help you.

Edited by Reneer
Link to comment
Share on other sites

Yeah I would help if it was in the source Papyrus Code. I have been scripting in for bethesda games ever since Skyrim So I could help but I cant read assembly code

Link to comment
Share on other sites

Yes, definitely consider posting your source code, not assembly. Jeez that thing. :wacko: Took me a while to figure it out, but I think I cracked it. :D

 

As a disclaimer, I am not an assembly programmer, we have just studied the theory of how code is turned from higher abstraction level to assembly edit: whoops, meant machine code (getting tired, need to get some sleep... :facepalm: ) to microcode at the university, so it is perfectly possible that I am completely off here. Still learning, but I thought it would be interesting to try. By the looks of it, that is only a fragment of the whole code, and what I potentially might have managed to figure out were these two Properties:

Message Property MessageVertibird Auto
MiscObject Property Caps Auto
And then the rest of the actual functionality of that fragment is probably something like this, maybe:
    ...
    If(aiButton == 3)
        aiButton = MessageVertibird.Show(<int>)
        If(aiButton == 0)
            <player>.PlaceAtMe(<ObjectReference> as Form, 1)
            <player>.RemoveItem(Caps as Form, 1000, True)
        ElseIf(aiButton == 1)
            <player>.PlaceAtMe(<ObjectReference> as Form, 1)
            <player>.RemoveItem(Caps as Form, 1000, True)
        EndIf
    EndIf
    ...
And that is where it ends. Having the source code script would be great because I am not sure it actually looks like that. Especially the castings, I have no idea if they are there like that. The ObjectReference in PlaceAtMe could be the value it returns, too, perhaps, since PlaceAtMe returns an ObjectReference and temp39 is an ObjectReference. This one:

CAST ::temp38 ::MFTV_var ;@line 124
CALLMETHOD PlaceAtMe ::Player_var ::temp39 ::temp38 1 False False True ;@line 124
But since there is only one CAST thingy and the following AddItem also has both Form AND MiscObject after it, I am not sure what CAST means, exactly. This is an interesting puzzle. :P

 

Did you check your inventory after the purchase? Because RemoveItem function is this:

Ref.RemoveItem(Form akItemToRemove, int aiCount, bool abSilent, ObjectReference akOtherContainer)
And if you call it like this:
Ref.RemoveItem(Caps as Form, 1000, True)
It will make it "silent", as in, not display a message about the removal, even though items actually are moved in the background. Maybe that is it? Assuming you use it like that. The actual source would be great. :D

 

If I am completely off with everything, feel free to correct me. :blush:

Edited by Contrathetix
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...