Difference between revisions of "Category talk:Scripting"

Jump to navigation Jump to search
2,001 bytes added ,  10:52, 28 September 2011
imported>Candc4
m (get in that script box strangler)
imported>DragoonWraith
Line 242: Line 242:
  ; Kills player if endurance is less then 100  
  ; Kills player if endurance is less then 100  
  End Unnamed
  End Unnamed
:OK, so there are a few problems here. You seem to be assuming that script works like some other scripting languages, perhaps? Because you're not using [[Begin]] or [[End]] or the OnPCEquip [[blocktype]] correctly, which is your problem. You're also using <tt>player-></tt>, which is how some languages (C++, for one) would handle a similar operation, but script uses <tt>player.</tt> for that (as would C++ in other situations). Finally, there is no "GetEndurance" function, you have to use [[GetActorValue]]. I'd recommend reading [[Scripting Tutorial: My First Script|My First Script]] and [[Scripting Tutorial: My Second Script|My Second Script]] for some useful tutorials in how the language works.
:I also recommend that you use indentation to make your code easier to read. Anyway, your script should look something like this:
ScriptName Unnamed
short equipped ; don't use function names for variables
Begin OnPCEquip
  if ( player.GetActorValue Endurance < 100 )
    player.Kill ; [[Kill]] will kill th eplayer
    MessageBox "You have been crushed by a Scripted Item."
  endif
End
:Hopefully that will give you something to look at for help. However, in the future, this is not really the best place for trouble-shooting; the {{Forums}} are best for that. This would be more of a place to ask questions about specific articles, or where to find information. I am curious, however, how you tried to find information before posting; what you looked at and stuff (or where you looked and failed to find things), because your script doesn't look bad, just not written in Oblivion's scripting language. I'm curious where you got those ideas, ''especially'' if it was from this site (because I want to fix that).
:[[User:DragoonWraith|<span style="font-family: Oblivion; size=2;">D</span>ragoon <span style="font-family: Oblivion; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion; size=2;">TALK</span>]] 11:52, 28 September 2011 (EDT)

Navigation menu