Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] [Solved] Text replacement in Papyrus... with variables?


bleakraven
 Share

Recommended Posts

Hi TESA!

 

Once again I'm in trouble, or rather, wondering something...

 

Is there a way that I can replace the name of an objectReference or other property within my script with other variables? An example would be:

 

I have an ObjectReference called Stage1_CMP1. I have a GlobalVar that takes in Ints as its value. Can I do something like: 

 

Stage1_CMP+(myAwesomeGlobal.GetValueInt()   ?

 

Cheers!

Edited by bleakraven
Link to comment
Share on other sites

whoo hoo ... sorry just figured it out on the way to work :)  If you cast your global integer as a string and then concatenate it to your original objectreference name and then reference the value of the new object ... voila!!!

ie: 

mynewobject = Stage1_CMP+(myAwesomeGlobal.GetValueInt() as string

 

mynewobject.GetValue() ; will equal Stage1_CMP1

but you would only be accessing the new name .. it wouldn't be an object reference holding it's own object unless previously declared.

Link to comment
Share on other sites

So, all you want is a number?

 

Just define a property to the script. And leave it empty on the base objects script.

 

Then when you place the object in the world, on its properties script, give it a number. Only this object will have that number. One script, different values.

Then you can display that number in a message if you want and it will be unique to that object in the render window.

  • Upvote 1
Link to comment
Share on other sites

Yeah, create a non-assigned integer property.

 

Now on each object in the render window, you can set each one a different integer value and the script could even then do something special based on that number.

 

If iobject == 1

  ival = ival + 10

elseif iobject == 2

  ival = ival + 20

elseif iobject == 3

  ival = ival + 30

endif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...