Author Topic: Unused or deprecated script variables?  (Read 1237 times)

0 Members and 1 Guest are viewing this topic.

calan

  • Newbie
  • *
  • Posts: 44
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Unused or deprecated script variables?
« on: November 01, 2014, 03:21:10 PM »
Are there any unused entity def variables that can be accessed in the scripts, and reused for other purposes?

If not, how easy is it to add a new variable to an entity def and then access it in the related script? SDK work I assume?
Old bastard but kid at heart...

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: Unused or deprecated script variables?
« Reply #1 on: November 01, 2014, 04:21:33 PM »
from the scripts you can access to any spawnarg you want with any sort of key

a "spawnarg" is the name of any of the variables you set up in either the definition files or the level editor like "health"

and the "key" is the actual variable value  "100" in "health" for the player

in the level editor you can set up whatever spawnarg you want to any entity and it's key at whatever value you want and then:

for a integer return you can use:
Code: [Select]
$my_entity.getIntKey("pain_threshold"); (but it returns a float, as scripts only use floats)

for floats you can use:
Code: [Select]
$my_entity.getFloatKey("blink_min");
for entity you can use:
Code: [Select]
$my_entity.getEntityKey( "target" );
and for string you can use:
Code: [Select]
string monster_class;
monster_class=$monster.getKey("className");

as you can find in modwiki

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 935
  • Karma: +44/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Unused or deprecated script variables?
« Reply #2 on: November 01, 2014, 06:43:00 PM »
You can also make any entity & key/value at any time you wan, or use custom key/values in the editor.

IE for a func_static you can make a key/value in the editor called "Stupid/0".  Then in a script you can get that value and check the Stupid value (hehehe).

In scripting you can also make new entities and store any values you want in them.  IE you can make an entity called "doorcheck" and keep stats on how many doors the player walked through with it (that's a bad example as you can make a level wide variable in the level script to do the same thing).

It's pretty versatile in what you can do via scripting.

calan

  • Newbie
  • *
  • Posts: 44
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: Unused or deprecated script variables?
« Reply #3 on: November 01, 2014, 08:52:58 PM »

It's pretty versatile in what you can do via scripting.

I wish I had time to learn more about it. I have a lot of cool ideas I'd like to implement, but no time due to family, work, and other hobbies (shooting, fast cars, etc etc)....and time goes by faster every day.

Getting old sucks.  :)
Old bastard but kid at heart...