Jump to content

Photo

need help with script for setting robot conscious/unconscious via term


  • Please log in to reply
16 replies to this topic

#1
stevie70

stevie70

    Fan

  • Banned
  • PipPipPip
  • 484 posts
i want to set a robot conscious/unconscious via a terminal, been trying to figure out how to get this running for days now without the slightest success - maybe someone here can help, shouldn't be too hard for experienced scripters, but i just started scripting (more because i needed to to get my mod right than because i ever wanted to), and neither the geck-documentation nor reading similar scripts (fisto etc) made me any wiser...
so why don't these scripts work...:

robot script:
ref VBMisterHealthy
int iMisterHealthy
begin onLoad
if iMisterHealthy == 0
setUnconscious 1
endif
end

terminal script:
set VBMisterHealthy .iMisterHealthy to 1
VBMisterHealthy .set Unconscious 0

the terminal asks for imisterhealthy = 0 as an item condition (set to get script variable / run on reference)
and force redraw is checked.

this part should make the robot unconscious on first load (this works fine), and the terminal should wake it up and set the robots variable to 1 so it stays awake on next time re-entering the cell - this doesn't work at all.

I've tried this with making the robot a linked reference (incl. item-condition) and without, no changes.

and theres one thing about reference-syntax i basically don't understand, in scripts like fisto etc i noticed references reading like FistoREF - what's this REF at the end, is this part of the syntax or is this just a part of the name...? (trying to change my script according to this didn't change anything though)

well hope q's not tooo dumb & someone can help, it's about the last thing missing for my mod and i'd hate to dump it because of this, thx

#2
stevie70

stevie70

    Fan

  • Banned
  • PipPipPip
  • 484 posts
meanwhile i found & fixed lots of issues
in my script, but it STILL DOESN'T WORK,

current versions on robot:
ref VegasBabyMisterHealthyREF
int iMisterHealthy
begin onLoad
if iMisterHealthy == 0
setUnconscious 1
elseif iMisterHealthy == 1
setUnconscious 0
endif
end

on terminal:
set VegasBabyMisterHealthyREF .iMisterHealthy to 1
VegasBabyMisterHealthyREF .setUnconscious 0

(plus the same the other way around for powering down)
force redraw is checked.

i'm really out of any ideas why this doesn't work,
so PLEASE help anyone...?

Edited by stevie70, 29 March 2011 - 06:13 AM.


#3
PaladinRider

PaladinRider

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,173 posts
When you post scripts, use the
code tags

It makes it easier to read your scripts. The REF is referring to the persistant reference in the game world.
Does your script compile? I really recommend getting GECK Powerup from the Nexus. It will tell you if your script has any syntax errors.

#4
stevie70

stevie70

    Fan

  • Banned
  • PipPipPip
  • 484 posts

When you post scripts, use the

code tags

It makes it easier to read your scripts. The REF is referring to the persistant reference in the game world.
Does your script compile? I really recommend getting GECK Powerup from the Nexus. It will tell you if your script has any syntax errors.

yes, the scripts compile fine, and i had the spelling checked on http://www.cipscis.c.../validator.aspx
(i have geck powerup but keep forgetting to run it)

i attached a screenshot of the whole thing, the terminal part to the left, the robot to the right.
i really hope for any clues, i read every documentation, tutorial and script i could find over and over and i really haven't got the slightest idea left why this doesn't work.
and thx 4 answering at all, already thought nobody would (and i'm kind of desperate)...

Attached File  script.jpg   140.3KB   6 downloads

ah yes one more thing, sorry for asking stupid, but saying "the REF is referring to the persistant reference", do you mean if i call it xyREF it HAS to be a persistant reference...? don't know, i just dont't get this part (right now, the robot isn't set to persistant (but i've tried, didn't work either)

#5
PaladinRider

PaladinRider

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,173 posts
Well if you want to call the reference in another script, which we aren't, then Yes the persistent reference must be checked.

If you're using a lets say STMisterHandy creature (it's always good to make your own copy of the creature)
Then the Mister Handy you placed ingame could be named STMisterHandyREF

This probably isn't necessary if you plan to attach the script to every STMisterHandyREF. Make sure that STMisterHandy has your script selected.

Edited by PaladinRider, 29 March 2011 - 03:08 PM.


#6
davidlallen

davidlallen

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,563 posts
It is necessary to have a persistent reference, because the object is referred in the terminal script.

This is a FAQ: what is the difference between an object and a reference? An object is something like "a desk", there is one single definition of it. A reference is one of these objects somewhere in the world, like, "the front left desk in Mr Smith's classroom". There may be many references of the same object. To save memory, most references are not persistent, that is, they only take up space in memory when the player is in that cell (dungeon level) or nearby wilderness grid location. Non-persistent references don't have any name you can refer to. If you need to do something with the reference in a script, then it needs to be persistent, which basically means you give the reference a unique name. Even if you only have one reference of the object, the reference name must be different than the object name.

To make a reference persistent and give it a unique name, double click it in the cell window; check the "persistent reference" checkbox, and enter a unique value in the "reference ID" field at the top. For the common case where you have one reference of a given object say "foo", modders often name the reference "fooRef" because it is easy to remember. There is nothing magic about the "ref" suffix.

For your robot, did you make it persistent? Is the name you put in the terminal script the reference name? Is the terminal in the same room with the robot, so you can immediately see if the "setunconscious" takes effect when you use the terminal?

#7
stevie70

stevie70

    Fan

  • Banned
  • PipPipPip
  • 484 posts

It is necessary to have a persistent reference, because the object is referred in the terminal script.
[...] There is nothing magic about the "ref" suffix.

ah yes, thanks for that.

For your robot, did you make it persistent? Is the name you put in the terminal
script the reference name? Is the terminal in the same room with the robot, so
you can immediately see if the "setunconscious" takes effect when you use the
terminal?

the robot, right now is persistant (think you can see it checked in the screenshot), but it didn't work either way (i tried non-persistant, too because i somehow thought, if i have a reference variable defined in a script by ref XXX, the program knows it's there anyway no matter if persistant or not). the terminal, right now, is persistant too, don't think it needs to be, but doesn't make any difference as well. i've tried with and without the robot being a linked reference to the terminal, no difference.
both the terminal as well as the robot are unique objects, and both are in the same interior cell. i've even tried making fresh test-mods with nothing but the robot and the terminal in it, still nothing... and i can neither find any more errors in syntax nor can i see any fundamental differences to the scripts of say fisto, that work fine obviously.
the problem seems to be, that the robot never gets the iMisterHealthy-variable from the terminal (because if it did and a change of the variable was returned, it should display a different menu item as well). could it have something to do with the robot-script being in a onLoad block? but this should work with force redraw checked, no...? and i didn't want to put it in a game mode block (no idea if that would work anyway) cause i think it's kind of stupid to have it checked all the time just switching on and of...
this is really starting to freak me out, the whole mod is done (and looks and works great) apart from this with fine working scripts that do far more complcated things than this that took me weeks of learning to do them and now i can't switch on the bloody robot... :-P

#8
PaladinRider

PaladinRider

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,173 posts
try this;
This is what I did with the mister handy's at the beginning of the Run The Lucky 38 mod.
In the geck, I set their health to 0, so they're dead at the beginning of the game.
When the player wants to activate them, I resurrect the handy.
Now I think the Handy's heatlh will only be like 1 at this point, but at the same time I just enable different Handy's and disabled the original handy's (when the player left the room). This makes it seem like they were activated then moved to their working spot.

Although I have no idea why the conscious /unconscious isn't working for you

#9
rickerhk

rickerhk

    Resident poster

  • Premium Member
  • 2,958 posts
Try using

ActorREF.DamageAV Fatigue 1000
Instead of setunconscious.

Then

ActorREF.RestoreAV Fatigue 1000
To wake it up.

#10
stevie70

stevie70

    Fan

  • Banned
  • PipPipPip
  • 484 posts
finally did it...! thanks for the help everyone, i used none of your approaches in the end, but they made me rethink and rewrite the whole thing and now it works fine. basically i used getunconscious (should have thought of that earlier) instead of my own variable, and i think i must have done something better with calling the references this time, but don't ask me what :-)

i think i'm going to have the mod posted by the weekend latest when i'm done with some final details & testing, hope you'll check it out and like it...




Page loaded in: 1.125 seconds