Jump to content

Help with scripting error - CurrentCellRef


scm1893

Recommended Posts

Carcernus v 3.0 - A Prison Mod by SurfingApe

 

This mod has a couple of scripts that allow me to send anyone to prison and move them to other cells. I am trying to adapt the scripts to my mod but I've hit a snag.

 

This is a line from SurfingApe's script:

set COMPrisonQuest.CurrentCellRef to COMHoldingAMarker

 

Here's my modified line:

set rhPrisonQuest.CurrentCellRef to rhDungeonHoldingMarker

 

When I try to save the script, I get the following errors.

 

1. Unknown variable or function 'CurrentCellRef'
2. Syntax error. Missing expression in set command.

 

(Sometimes I get this error instead of the syntax error:  Missing variable name in set command.)

 

I've had no trouble converting scripts unless it contains CurrentCellRef. I've gone all through the mod looking for something I've missed that identifies CurrentCellRef for the CS script tool. As near as I can tell, I've duplicated all necessary components and scripts. I've found absolutely nothing on CurrentCellRef through searches.

 

The CS recognizes his script and saves; mine it feeds me an error.

 

Any ideas where to look would be appreciated.

 

 

Link to comment
You should check the following sites if you think it to be the function that it is prepared.
If your claim is right, I am found, but am not found if wrong.
 
 
 
At least I have not watched such a function.
When there is a player in Interior, I acquire Cell in GetParentCell.
I think that it is the method that it is usually used in to acquire Cell in GetParentWorldSpace when there is a player outside Interior.

 

Link to comment

you propably forget to select your questscript to your quest

 

(Sometimes I get this error instead of the syntax error:  Missing variable name in set command.)

that means that you propably attaching an objectscript to your quest instead of a questsript

if you are attaching an objectscript to your quest the cs unselect it and leave it blank(NONE)

 

 

scn COMPrisonQuestScript

short currentcellnumber
ref currentcellref    ;here is the original - you should have this line in your rhPrisonQuestScript

Link to comment

Thanks for the links perfectioncat. I had looked through the scripting articles in the ESWiki but I didn't find any reference to CurrentCellRef. I'm trying to determine if it is a normal function of the CS or something special surfingape did. It may be a function in the CSExt. I'm using the base CS so I don't know.

 

kastano, I think I had caught that and corrected it, but I've messed with so much, it can't hurt to check it. Thank you.

Link to comment

I may not serve as a reference, but show the function that I use because I pinpoint the place.

 

 

 

scn zzzPEMGetCurrentPlace

ref CellRef

ref playerRef
float px
float py
float cx
float cy

begin function { playerRef }
	if playerRef.IsInInterior
		set CellRef to playerRef.GetParentCell
		set zzzPEMGoHomeMagicQuest.CurrentPlaceName to sv_Construct "%n:(%i)" CellRef CellRef
	else
		set px to playerRef.GetPos X
		set py to playerRef.GetPos Y
		set cx to px / 4096 - ( 1 * ( px < 0 ))
		set cy to py / 4096 - ( 1 * ( py < 0 ))
		set CellRef to playerRef.GetParentWorldSpace
		if HasName CellRef
			set zzzPEMGoHomeMagicQuest.CurrentPlaceName to sv_Construct "%n:(%.0f,%.0f)" CellRef cx cy
		else
			set zzzPEMGoHomeMagicQuest.CurrentPlaceName to sv_Construct "Tamriel:(%.0f,%.0f)" cx cy
		endif
	endif
end

 

 

Link to comment

I may not serve as a reference, but show the function that I use because I pinpoint the place.

 

Forgive my scripting noobiness; does your script move a NPC from one point to another? I can understand enough to see how you pinpoint the position.

 

 

Here is surfingape's full script. (formatting lost in copy/paste)

 

scn COMPrisonControlScript

short ActiveScripting

short HoldingCells

short Cellblock A

short choice

begin OnEquip

set ActiveScripting to 1

messagebox "Select Holding Cell, or Cells 1 through 7" "Holding/Cagefight A" "Holding/Cagefight B" "Questioning Pit" "Questioning Area " "Cell 1" "Cell 2" "Pit Cell 1" "Pit Cell 2" "Pit Cell 3"

end

begin GameMode

if (activeScripting == 1)

set choice to getbuttonpressed

if (choice == -1)

return

elseif (choice == 0)

set COMPrisonQuest.CurrentCellRef to COMHoldingAMarker

set COMPrisonQuest.CurrentCellNumber to 100

elseif (choice == 1)

set COMPrisonQuest.CurrentCellRef to COMHoldingBMarker

set COMPrisonQuest.CurrentCellNumber to 200

elseif (choice == 2)

set COMPrisonQuest.CurrentCellRef to COMCellOneMarker

set COMPrisonQuest.CurrentCellNumber to 1

elseif (choice == 3)

set COMPrisonQuest.CurrentCellRef to COMCellTwoMarker

set COMPrisonQuest.CurrentCellNumber to 2

elseif (choice == 4)

set COMPrisonQuest.CurrentCellRef to COMCellThreeMarker

set COMPrisonQuest.CurrentCellNumber to 3

elseif (choice == 5)

set COMPrisonQuest.CurrentCellRef to COMCellFourMarker

set COMPrisonQuest.CurrentCellNumber to 4

elseif (choice ==6)

set COMPrisonQuest.CurrentCellRef to COMCellFiveMarker

set COMPrisonQuest.CurrentCellNumber to 5

elseif (choice == 7)

set COMPrisonQuest.CurrentCellRef to COMCellSixMarker

set COMPrisonQuest.CurrentCellNumber to 6

elseif (choice == 8)

set COMPrisonQuest.CurrentCellRef to COMCellSevenMarker

set COMPrisonQuest.CurrentCellNumber to 7

else

message "Not covered by the if stuff"

endif

message "Transport area is set"

set ActiveScripting to 0

endif

end

 

This is the script for COMPrisonQuest

 

 

scn COMPrisonQuestScript

short currentcellnumber

ref currentcellref

short doOnce

short RestrictedSpells

begin gameMode

if (doOnce != 2)

player.addspell COMGoToYourPrison

messagebox "You have an insight into the location of an ancient Ayleid prison complex called Carcernus."

set doOnce to 2

set RestrictedSpells to 0

endif

end

 

I was able to convert and save COMPrisonQuest w/o any error though it has CurrentCellRef variable.

Link to comment
You should use code tag if you stick a script.
A format is not lost.
 

 

I may not serve as a reference, but show the function that I use because I pinpoint the place.

 

does your script move a NPC from one point to another?

It is a function to return the place where a player is now.
 
If it is a method to choose some specific places, I think that it is not necessary to pinpoint the place.
You should use Array structure not IF sentence structure.
It will become a more concise script.
Link to comment

CurrentCellRef is one of SurfingApe's own variables, defined in the script for COMPrisonQuest. Define your own variable and use that instead.

 

 

scn COMPrisonQuestScript

short currentcellnumber
ref currentcellref  <----- this thing here
short doOnce
short  RestrictedSpells

begin gameMode

    if (doOnce != 2)
        player.addspell COMGoToYourPrison
        messagebox "You have an insight into the location of an ancient Ayleid prison complex called Carcernus."
        set doOnce to 2
        set RestrictedSpells to 0
    endif
end

Link to comment
  • 3 weeks later...
You should use Array structure not IF sentence structure.
It will become a more concise script.

 

 At this point, I can only copy/paste scripts. I have little actual scripting ability. I wouldn't know how to code an array.

 

 

CurrentCellRef is one of SurfingApe's own variables, defined in the script for COMPrisonQuest. Define your own variable and use that instead.

 

Thanks JSmith,

 

Sorry about the delay. I've been away for two weeks. Let me see if I understand this correctly.

1. COMPrisonQuest calls for COMPrisonQuestScript

2. COMPrisonQuestScript defines currentcellref  (by this line; ref currentcellref)  as the current cell location of the player?

3. COMPrisonControlScript then uses that definition/location in this line (set COMPrisonQuest.CurrentCellRef to COMHoldingAMarker) to change the location of a target to the location held  by COMHoldingAMarker

 

When you say to define my own variable, do you mean simply change the line to read, ref ChangeTextHereRef or does it involve more than that. I know I have to change all instances but is there anything else that must be done to define this variable.

 

I am going to try the script again because the first time I tried to compile it (with this line, set rhPrisonQuest.CurrentCellRef to rhDungeonHoldingMarker)  rhPrisonQuest didn't exist.

EDIT* Script still didn't work. Got the same errors regarding currentcellref.

 

 

For anyone interested, I've got another script issue I need some help with. It is a revamp of this Carcernus Prison script.

 

scn COMImprisonTargetEffect

 

ref ThisRef

 

begin ScriptEffectStart

      set ThisRef to GetSelf

      moveto COMHoldingAMarker

      messagebox "They have been thrown into your holding cells inside Carcernus!"

     SetFactionRank COMPrisoner, 0

end

 

This script sends the target to a holding cell in the prison. It works fine in the Carcernus Prison mod. I revised it for my mod. I built a dungeon with a holding cell and placed a npc in the dungeon outside the holding cell. When I cast the imprison spell, my npc is sent to the holding cell. However, when I go to an outside location such as a city and cast the spell, the target disappears and I get the proper message. But when I go to the dungeon, they are not in the holding cell or anywhere else. I don't get it. It works within the dungeon but won't work properly outside the dungeon.

Link to comment

If you read a document attached in OBSE, you should be able to understand sequence.

I do not know which document you mean. I've been through the OBSE documentation page you showed me. I've been through the Wiki.

 

Do you not think that ScriptEffectStart is carried out only once?

Once, each time the script is active.

If you output a practice history using printoconsole, you can understand it.          

 

I do not know how to do this.

Link to comment

 

If you read a document attached in OBSE, you should be able to understand sequence.

I do not know which document you mean. I've been through the OBSE documentation page you showed me. I've been through the Wiki.

http://obse.silverlock.org/

 

 

Do you not think that ScriptEffectStart is carried out only once?

Once, each time the script is active.

It depends on the performance of the PC, but may be carried out several times.

 

If you output a practice history using printoconsole, you can understand it.          

 

I do not know how to do this.

 

printtoconsole outputs character string by a format appointed to a console screen.

The simple examples are as follows.

 

PrintToConsole "pass"

 

If you insert printtoconsole in the suitable place of the script, you know a point carried out.

Link to comment

Your script rhPrisonQuestScript, which is the quest script for the quest rhPrisonQuest, needs to define the variable currentCellRef, then other scripts in the mod can use it, which is what SurfingApe's doing here. For example

 

scn rhPrisonQuestScript

 

<first variable definition>

<second variable definition>

ref currentCellRef

<another variable definition>

 

Begin GameMode

   <things happen, including assigning a value to currentCellRef>

End

 

scn rhPrisonDemolitionScript

 

ref jackhammerPosition

 

BeginFunction { }

    set jackhammerPosition to rhPrisonQuest.currentCellRef

   <break something at this position>

End

 

The other scripts in your mod can now use the variable rhPrisonQuest.currentCellRef. They can read it, as in the example above, or write to it -

  set rhPrisonQuest.currentCellRef to <whatever>

and the compiler will know what you're talking about. There is nothing magical about currentCellRef; it's just another variable defined in the quest script. This is a cheap way of achieving the same effect as using a global variable (shock, horror) in other programming languages. You could take SurfingApe's mod and change all mention of currentCellRef to chocolatePenguins, and it would still build and work, although it may then be a little harder to comprehend.

 

 

 

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use