New @ scripting & failing hard.
#1
Posté 24 avril 2011 - 11:12
1 void main ()
2 {
3 object oTakeFrom;
4 object oItem;
5 oTakeFrom = GetLastSpeaker();
6 oItem = keburskey;
7 ActionTakeItem(oItem, oTakeFrom);
8 }
I am still recieving this error message:
4/24/2011 4:06:23 AM: Error. 'skolakey001' did not compile.
skolakey001.nss(6): ERROR: VARIABLE DEFINED WITHOUT TYPE
Any help would be appreciated.
#2
Posté 24 avril 2011 - 11:41
#3
Posté 24 avril 2011 - 11:55
#4
Posté 24 avril 2011 - 12:00
#5
Posté 24 avril 2011 - 12:24
Amberwall wrote...
I can't find a way to change the ResRef on the key and "item" seems like it would become a problem as more are created. How do I change this?
Right click on the blueprint in the list, select "Copy Blueprint" ---> "Module" - that will create a new copy of the blueprint where you can change all it's properties including its ResRef.
Also, I highly suggest my scripting tutorial, it is written for the beginning scripter. Link is in my sig below.
If you still need help with your script, we will be happy to do that. Let us know.
Modifié par _Knightmare_, 24 avril 2011 - 12:25 .
#6
Posté 24 avril 2011 - 12:56
The issue you are running into is line #6, you are not properly identifing oItem. There are several ways of doing this if you want to write your own script.
oItem = GetItemPossessedBy(oTakeFrom,"keburskey"); if you are using companions you will need to loop through all factions members checking for the key.
I would suggest opening the above mentioned scripts to see how the game handles these situation and their include script NW_I0_PLOT. Reading the tutorials and reading through scripts is going to be your best bet. Hope this helped and good luck.
#7
Posté 24 avril 2011 - 01:06
Again, thanks, both of you.
#8
Posté 24 avril 2011 - 05:59
#9
Posté 24 avril 2011 - 07:59
How's the rest of your project coming along?
#10
Posté 24 avril 2011 - 09:44
#11
Posté 25 avril 2011 - 12:40
The Fred wrote...
If you spend about 5 years just looking at the scripts, you suddenly understand everything. It's amazing! ;-)
Lilac Soul's is a great way to learn basic scripting - after using it enough times you will begin to see patterns to the code.
Happy Building!
#12
Posté 25 avril 2011 - 12:19
Morbane wrote...
The Fred wrote...
If you spend about 5 years just looking at the scripts, you suddenly understand everything. It's amazing! ;-)
Lilac Soul's is a great way to learn basic scripting - after using it enough times you will begin to see patterns to the code.
Happy Building!
Agreed, that was my main "teacher" while learning to script.
#13
Posté 25 avril 2011 - 06:40
The Fred wrote...
If you spend about 5 years just looking at the scripts, you suddenly understand everything. It's amazing! ;-)
Darn. That hasn't worked for me. I must be slow.
I cannot believe that the original NWN and NWN2 develop teams did not have standard scripting guidelines that they followed. If they had just released those it would make things a whole lot easier. As it is, I think everyone does a lot of guessing and testing. I know I still do.
#14
Posté 26 avril 2011 - 10:41
*Incidentally, it may cheer up anyone learning to script to know that this was my first attempt:
void main()
{
ActionCastFakeSpellActionAttack
}
Unsurprisingly, that didn't work.
Modifié par The Fred, 26 avril 2011 - 10:42 .
#15
Posté 26 avril 2011 - 02:11
#16
Posté 27 avril 2011 - 04:44
Kaldor Silverwand wrote...
The problem is that experience is not the best teacher. Experience only teaches what works within a context. What we need is context-independent scripting advice and only the vendors could have provided that. Since they haven't what we have is people who have experience only within specific context and no broad guidelines. A script generator, no matter how cleverly written, is no substitute for documented standards. The only official documentation I have seen are the NWN and NWN2 Scripting guides published by Brady Games and they were very basic.
Hmm, i don't really buy that. Best way to learn a language is to speak it, and programming is actually a language.
The longer people script, the more their methods start to look the same. When i hear other experienced giving advice, well most often it's exactly what i would say. If there is a consensus like this, i suspect there is some truth involved. The longer you do nwscript, the more you learn, the more you oops, and eventually you start realizing some things work and some don't. I have my own preferences as to the correct way to do things, and while those are my personal preferences i have noticed they are shared by quite a few others. This makes me think there is a correct way to do things, but i do not presume to be doing that myself yet.
I also don't see the "official" rubber stamp as valuable. That is a myth, the "source" is seen as the arbiter of value instead of the actual quality involved. This game does not have the best reputation with regards to quality from the get go. We have folks in our community who can program circles around the developers, and in fact the developers often went to them seeking help - note that some of the major bugs the devs tried to fix in patch after patch were patched in via xp_bugfix and the client extender. Just compare kaedrins classes to the official ones and despite him being not able to add things to the engine his results are a lot more polished. He even fixed quite a few of the developer bugs like the spirit shaman/sorceror double spell book. I really wished they hired him to do the next expansion, it would have been sweet. If you look at the official code, well i would never ever recommend that as how you should program -- the number of bugs and issues which were not fixed until rpgplayer1, TonyK and skywing rewrote quite a few things. I personally have been forced to completely remove ANY reference to official code to side step major issues in the official libraries.
I would suggest instead looking for those who make quality bug free code, and those who are do programming for a living, and use them as a resource. I would ask for advice from more learned programmers, especially those who speak from experience. The fact is the problems a new scripter is going to encounter, are basically the same things now as it was when i started. Some who listen can short circuit that learning curve, but if they really want to do it all themselves, so be it. I am pretty sure after you've spent as many hours coding as i have, your opinions on what is correct and incorrect will for the most part be similar to mine. I would actually look for the ones whose experience dates back to the beginning of NWN1, who are even wiser than me after many more hours.
I would also of course say you need to communicate with your peers who are just a little better than you, who are still struggling. We are not just individuals, we are a community here and that cannot be forgotten. We all need to help each other, both here in the forums, but also by sharing code and making sure what we write is well documented and easy for both new and old scripters to understand, and communicating issues we find in others code to improve the game for all the players.





Retour en haut






