cloudee1 |
Just when you think it is safe to go back into the water! GARY_P = 0 is a global variable I have this which is the only place the variables changes. (if(Said('[talk<to]/gary')) (if(< (send gEgo:distanceTo(garyMan)) 65) (if(== GARY_P 1) = state 17 = cycles 1 )(else = GARY_P 1 = state 0 = cycles 1 ) )(else Print("Don't yell at Gary,")) ) when I talk to gary it goes to state 0 just fine but if I talk to him again it does not change state at all it does nothing, I need to get to sate 17 and beyond. here are my states. ... (switch (state) (case 0 (if(not(TALK_TO))return)) (case 1 ProgramControl() ... return) (case 17(if(== GARY_P 0))return) (case 18 ProgramControl() ... Can someone please please please :-\ help? :-\ |
Brian_Provinciano |
Use the (instanceName:changeState(17)) and (instanceName:changeState(0)) instead of simple "= state XX". States were a fantastic design decision by Sierra! I love them as well. They are used all the way through SCI3! Good Luck! |
cloudee1 |
I don't know how to set up multiple changestate instances, that is what this refers to, right? (instanceName:changeState(x)) I don't know where or how to use this statement. ... "post edited by cloudee1, see later attatchment if you would like to see script this question has led too " |
cloudee1 | AAAAAAUUUUUUUUUUGGGGGGGGGGGHHHHHHHHHH!!!!! |
cloudee1 |
Ok I have done some major rearrangeing and the problem is that it is not accessing the JelLy instance which is now the first return and thereby not running the states therein, It now returns the second time correctly so it has to be in my setup of it or the way I am trying to access it. I have changed it so that all of the view's init's happen inside the changestate and at the end of their use I added a dispose(), I thought that might help. I have this: The instance I can't seem to get to! (instance JelLy of Script (properties) (method(changeState newState) = state newState (switch(state) (case 0 (if(not(TALK_TO))return)) and this: How I'm trying to get there! (if(Said('[talk<to]/gary')) (if(< (send gEgo:distanceTo(garyMan)) 65) = TALK_TO TRUE (if(== GARY_P 0) = GARY_P 1 (JelLy:changeState(0)) = cycles 1 )(else(if(== GARY_P 1) (RoomScript:changeState(20)) = cycles 1 )) )(else Print("Don't want to yell at Gary,")Print("Get Closer!")) ) This process is the heart of my dialog and is very important to my game! What am I doing wrong? |
cloudee1 |
Guys seriously here I need help :( I have attatched my rm001.sc a couple of posts down. Help me Help me Help me Pleeeassssseee!!! :-\ |
Brian_Provinciano |
What you are doing is this: (case 0 (if(not(TALK_TO)) return ) ) (case 1 ... Well, if TALK_TO is false, it will return, yes. But, what if it's true? Then essentially the same thing will happen. You forgot to set your cycles or seconds property in case 0. This would work: (case 0 (if(TALK_TO) = cycles 1 ) ) |
cloudee1 |
alright brian I tried adding a cycle here and there to no avail, so instead I have deleted case 0 from JelLy Instance so that now it starts without checking the TALK_TO value and the first case displays, but it does not move to case 2, case 3, etc. Unfortunately I still need direction |
Brian_Provinciano |
well, for one, you're doing: (JelLy:changeState(20)) there is not state case#20 in the JelLy instance, so nothing will happen. |
cloudee1 |
My Bad, see, I try what you say, then I try about a million other things and there have been times when I had changed that to go to the same place as the other return and I must have forgot to change that variable back to 1, but I assure you that that is not the problem, jus an oversight before attatching, but I've reattatched my best version of it to this post, Thank You for your patience Brian. My problem is that it does not advance through the jelly instance, It appears to do the first step but does not continue through the cases. |
cloudee1 |
someone? anyone? hellloooo, :-\ :( ??? :'( |
Robin_Gravel |
Come on Brian! I have the same problem than cloudee1. Robin Gravel |
Brian_Provinciano | I've been very busy with SCI Studio lately. If you want me to figure out your problem, send me the whole game. I need all the views/pics and any scripts linked to the room you're having problems with (ie. script.000) in order to compile it quickly and find your problem. |
Robin_Gravel |
Hi cloudee1 Finally. I made it to work and solved my problem too. Here the code: Robin Gravel |
cloudee1 |
If you look at the two previously attatched scripts you will see one major difference, The first has a JelLy Instance, the other does not, I want to know how to make the seperate instance run. the second script does not involve the JelLy instance. Robin I sent you my game so you could fix your problem by seeing what I did, posting my script here does not answer my original question, it only tells everybody that the problem is solved, when it's not. Question: Why won't jelly instance run in first attatched script? |
Robin_Gravel |
I mighty not understand to your question. Do you wish to see to run the instance script when the game begins? Robin Gravel |
Robin_Gravel |
Hi cloudee1 I checked your game again. I changed (RoomScript:changeState(20)) to (RoomScript:changeState(1)) in (if(== GARY_P 1) section. (RoomScript:changeState(1)) works but not (RoomScript:changeState(20)) I suspect the template has a bug or sci studio itself. Also I removed JelLy:changeState and keep RoomScript:changeState alone. It should work this way. (case 16 ... ) (case 20 ... ) ... Robin Gravel Note: I lost the messageboard a few minutes ago. |
Brian_Provinciano |
No, there are no bugs in it. I will explain fully why both your codes are not working. cloudee: You have: (if(TALK_TO(FALSE)) =cycles 1 = state 100 )(else return() ) that compiles to this: (if( TALK_TO FALSE ) the TALK_TO is ignored because it is followed by another expression. Which in turn, executes simply as: (if( FALSE ) Therefore, it will always execute the "return" and never execute the "= cycles". Second, the "= state 100" will not give you the desired results either. You should not actually be touching the state property there. To change states, you call the changeState(newState) method. The changeState method is executed. So, for example, if you call changeState(0), it will execute state #0 because of this: (switch(= state newState) (case 0 = cycles 10 ) (case 1 = seconds 20 ) (case 2 // do nothing ) (case 3 = cycles 10 ) Cycle #0 will be executed, then 10 cycles later, cycle #1 will be executed, then 20 seconds later, cycle #2 will be executed. Since cycle #2 doesn't set the seconds or cycle property, the changeState loop will stop. cycle #3 will not be executed. Now take for instance this: (switch(= state newState) (case 0 = cycles 10 ) (case 1 = seconds 20 ) (case 3 = cycles 10 ) It is EXACTLY the same thing. It executes cycle#0, then cycle#1, there's no cycle#2, so when it executes cycle#2, there's nothing to set the seconds or cycles properties, and thus, the changeState loop will halt execution. Separating case#16 and #20 has no advantage to using case #16 and case #17, provided that case #16 doesn't set the cycles or seconds property, it will not continue to #17. Also, it's possible to execute the changeState from the middle of a normal case array. |
Robin_Gravel |
Hi Brian I understand to your examples but. What does(RoomScript:changeState(20)) not work but (RoomScript:changeState(1)) does? Here cloudee1's code: (if(== GARY_P 1) (RoomScript:changeState(20)) = cycles 1 ) This code does not work but (if(== GARY_P 1) (RoomScript:changeState(1)) = cycles 1 ) This code works. Here the case 20 (case 20 ProgramControl() (send gEgo:hide())(garyMan:hide()) (talkingFrame1:init()setCycle(Fwd)setPri(16))(talkingFrame2:init()setCycle(Fwd) setPri(16)) (talkingBob1:init()setPri(13))(talkingGary2:init()setPri(13)) (bobMouth:init()loop(2)setPri(14))(garyMouth:init()loop(1)setPri(14)) (bobEyes:init()loop(1)setPri(14)setCycle(End))(garyEyes:init()loop(2)setPri(14)) = cycles 10 ) Robin Gravel |
Brian_Provinciano |
(RoomScript:changeState(1)) worked, but (RoomScript:changeState(20)) did not because in both scripts cloudee posted, the "RoomScript" instance did not have a "case 20". There was a "case 20" in a Jelly instance, but calling "RoomScript:changeState" does nothing for "Jelly". For that you would need to call "Jelly:changeState". |
Robin_Gravel |
Brian. When I changed (Jelly:changeState(20)) to (RoomScript:changeState(20)) I removed Jelly instance as well. Here the script: Robin Gravel |
humanity | I've been fighting this same thing myself. You probably figured this out before I did, but method doit seems to interrupt the changestate process, so that the first case will run, but not others. When I removed the method doit code, the changestate process incremented as expected. Hope this helps. |
Brian_Provinciano |
The whole changeState engine is built within the scripts. If you want to understand how they work, when doit()s are executed, when they are executed, etc. look through the scripts. I can assure you all there are no bugs with the changeStates, you are just not using them correctly. They were used in ALL sierra SCI games all the way through Leisure Suit Larry 1VGA,2,3,5,6,7, King's Quest, 1SCI,4,5,6,7, Space Quest, 1VGA,3,4,5,6, and all the others! Even Police Quest SWAT! The class system in the template game runs IDENTICAL to Leisure Suit Larry 3's as that is what it was based upon. In fact, it runs Leisure Suit Larry 3's rooms perfectly. I have multiple explanations on how they work, including my EXTENSIVE help file, tutorial, and other random docs all over the place. Anyone who says SCI Studio lacks documentation (I'm looking at you Robin ::)) Hasn't given it much of a look. The help file documents the whole class system, all 29 scripts, 63 classes, all the methods in the classes, all the procedures, the 114 kernel functions, every syntax in SCI code, and along with the tutorial, every aspect needed to make a game with SCI Studio. If you want to know more about SCI, there is also the extensive FreeSCI documentation, and of course, the complete source codes to SCI Studio, FreeSCI, and all of their other tools. |
Robin_Gravel |
Hi BrianAnyone who says SCI Studio lacks documentation (I'm looking at you Robin ) Hasn't given it much of a look I READ THAT!!! Seriously, I'm still having problem to follow your help file. And the Print command is not in the help file. I can explain furter why I have problem with help file but this will be off-topic. Also in chapter 24 in the tutorial with Printing With Buttons. The newbie will have some problems with this code found in the tutorial: (var button) This is the correct code: (instance RoomScript of Script Robin Gravel |
Brian_Provinciano |
Robin_Gravel wrote: Haha! Don't take it so personal. If I didn't want you to see that, I wouldn't have posted it. First, the help file is not needed in the beginning. The tutorial is what a newbie must do first, then the help file is for _additional_ information. I didn't bother putting most of the stuff in the tutorial in the help file, because that would just be copy/pasting duplicate information. It's ALL covered by the tutorial and help file TOGETHER. Second, my code IS correct, and yours is not entirely. Anyone who has done the entire tutorial up to chapter 24 would know that (var) declarations must be at the top of the procedure/method. If they've just been copying/pasting code from the tutorial directly, they won't learn anything. I'm not going to put EXTRA, unnecessary code in the examples. It would just make them less flexible and more confusing. The example does not need to be in handleEvent(), nor in an if(Said()) statement. It could be pasted exactly as it is into an init(), for example. I was simply responding to your comment with the facts. It's nothing personal. Cool down. |
Robin_Gravel |
O.K Brian. If I'm still having problem with the help file I'll let you to know with a new thread. Robin Gravel |