Jump to content

Can't find error in this simple script


Glenstorm

Recommended Posts

Hi.

 

GECK wont let me save this script (keeps asking whether to save or not, and on confirmation does nothing and this goes on and on and on) and this usually points at a syntax error in the script. This is a simple script i wrote to test something

 

ScriptName asBinocularScript

 

float a;

float b;

int enable;

 

BEGIN onLoad

set a to 10;

set b to 5;

END

 

BEGIN onFire

set enable to 1;

END

 

BEGIN GameMode

if enable == 1

set enable to 0;

endif

END

 

I dont get why this throws an error. Am I missing something fundamental?

 

Thanks in advance

Link to comment
Share on other sites

nevermind......

saw it a second later......

 

what problems do the GECK tells you that this script has??

 

Does it say anything? Usually I figure out something is wrong with the script when I try to save it and then when closing it, It asks me whether I want to save it (regardless). I'm not aware of a build output or an error console or something like that but if there is, I would really appreciate it if you could point it out to me.

 

And there is another thing

 

When I try to print out the values of a and b through a message box in the game, both show up as 0.00 but a = 10 and b = 5 as initialised. Anyone know why?

Edited by Glenstorm
Link to comment
Share on other sites

when you try to save a script with mistakes, it pops up a box that says that there is a problem in a specific line, and tries to describe the problem

if you don't see such a thing, then maybe the script itself is written properly

 

are you sure that an OnLoad script can work on a weapon??

maybe if you throw it on the ground it will work??

or you could try switching this to an OnEquip block??

Link to comment
Share on other sites

when you try to save a script with mistakes, it pops up a box that says that there is a problem in a specific line, and tries to describe the problem

if you don't see such a thing, then maybe the script itself is written properly

 

are you sure that an OnLoad script can work on a weapon??

maybe if you throw it on the ground it will work??

or you could try switching this to an OnEquip block??

 

It was the OnEquip block. Works like a charm now. Will be publishing after polishing up a bit.

Link to comment
Share on other sites

so that was really the problem??

and changing the OnLoad to OnEquip solved it??

wow, that was a shot in the dark..... but hey, i'm glad you got it working

 

now, forgive me if this sounds rude (i don't intend it to), but what is the whole idea of the script??

i mean, what was it supposed to do exactly??

 

LOL, I just made that up (though it showed the problem I had with the real thing, also I managed to forget to change the scriptname to something general). I didn't want to show anything about what I intend to make, because frankly, I'm afraid I might not be able to deliver. But I'm fairly sure about this one. Hell, if it comes out as I want it to be, I'll post the link here.

 

And I forgot to thank you. Thanks a lot!

Edited by Glenstorm
Link to comment
Share on other sites

  • Recently Browsing   0 members

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