Serrieth Posted January 8, 2004 Share Posted January 8, 2004 Begin BellsOrder short Rang if ( Rang < 1 ) if ( OnActivate "active_6th_bell_01t" == 1 ) messagebox "You got the first one, has good sound" "Ok" Set Rang to 1 PlaySound3D "bell1" endifendif******************************************************************************if ( Rang == 1 ) if ( OnActivate active_6th_bell_02t == 1 )messagebox "You may know the first two, but what about the rest?" "Ok" Set Rang to 2 PlaySound3D "bell2" endif elseif ( OnActivate active_6th_bell_02t == 1 ) if ( Rang > 2 ) messagebox "You have chosen in the wrong order try again" "Ok" Set Rang to 0 endifendif******************************************************************************if ( Rang == 2 ) if ( OnActivate active_6th_bell_06t == 1 ) messagebox "The bells are singing well" "Ok" Set Rang to 3 PlaySound3D "bell6" endif elseif ( OnActivate active_6th_bell_06t == 1 ) if ( Rang >= 3 ) messagebox "You have chosen in the wrong order try again" "Ok" Set Rang to 0 endifendif******************************************************************************if ( Rang == 3 ) if ( OnActivate active_6th_bell_04t == 1 ) messagebox "Keep going the song is well on its way" "Ok" Set Rang to 4 PlaySound3D "bell4" endif elseif ( OnActivate active_6th_bell_04t == 1 ) if ( Rang >= 4 ) messagebox "You have chosen in the wrong order try again" "Ok" Set Rang to 0endifendif******************************************************************************if ( Rang == 4 ) if ( OnActivate active_6th_bell_03t == 1 ) messagebox "The swift sounds are awaking" "Ok" Set Rang to 5 PlaySound3D "bell3" endif elseif ( OnActivate active_6th_bell_03t == 1 ) if ( Rang >= 5 ) messagebox "You have chosen in the wrong order try again" "Ok" Set Rang to 0endifendif******************************************************************************if ( Rang == 5 ) if ( OnActivate active_6th_bell_05t == 1 ) messagebox "The sounds, you are the one, the Tower of Sun Rise is unlocked." "Ok" PlaySound3D "bell5" Playsound3D "Open Lock" Unlock Ex_BM_tomb_door_Tower Set Rang to 10 ;makes it so you don't have to repeat the bells endif elseif ( OnActivate active_6th_bell_05t == 1 ) if ( Rang >= 6 ) messagebox "You have chosen in the wrong order try again" "Ok" Set Rang to 0endifendif****************************************************************************** end As you see above there is a code that you must check. The * just help me space my code out, so if its :huh: confusing, then sorry, okay now I made this code so that you must play 6 bells in a type of order, the order for now is 1 2 6 4 3 5But when I go into the game the code does not work right. What am I doing wrong?I made this code up my self, I know its stupid but please help. Link to comment Share on other sites More sharing options...
ctogher Posted January 8, 2004 Share Posted January 8, 2004 Ok... I may be absolutley wrong here but this may still hold true..... :blush: 1] Be careful of instatiating empty/null variables.... does the scripting language perform the initialisation for you? short RangMost languages only recognise this as an instruction to allocate stack space. If it was not initialised, whatever was written to the allocated stack space prior may still be greater than your test value, (eg. some other program wrote 50 to that particular allocation, which was subsequently released and you have now been allocated the same mem space.... this value is now being returned....) Perhaps try initialising Rang to 0...? :huh: Also try simplifying the if test..... eg:if ( Rang == 1 && OnActivate active_6th_bell_02t == 1 ) Finally, I note that your first if test is performed with the value "active_6th_bell_01t" in inverted commas, while the rest are not... is this significant? Link to comment Share on other sites More sharing options...
Stormscape Posted January 8, 2004 Share Posted January 8, 2004 intialization???WTF are you yabbering aboutThis is the CS, Not C++.Now I see no problems with the script.short rang is the only way toi add a variable... like short doOnce.. Link to comment Share on other sites More sharing options...
Serrieth Posted January 8, 2004 Author Share Posted January 8, 2004 Don't worry I found anouther way to make a puzzle, but if you have any suggestions to my code please tell me about them. I still have my eye on this code. It took me too long to do so I want to make sure I can correct it and maybe use it, would be a waste of time if I don't use the code. Link to comment Share on other sites More sharing options...
Lord Of The Cheese Posted January 8, 2004 Share Posted January 8, 2004 what im thinking is that your script is in a way contradicting it self it says "if ( Rang ==1 ) if (onActivate...==1) endif ;closing just the activate; then it goes to elseif(onactivate) then if (rang>2) basically its saying If (rang == 1) AND If (Rang > 2 ) then do the second stuff...heres my first suggestion: take each section (after the first and do this) if ( OnActivate active_6th_bell_02t == 1 ) ;moved up to make more cleanif ( Rang == 1 ) Set Rang to 2messagebox "You may know the first two, but what about the rest?" "Ok"PlaySound3D "bell2"endif ;on activate is still up and the Rang ==1 is endedif ( Rang != 1 ) ; what u had before was ok, but u could have clicked the last 1 firstSet Rang to 0messagebox "You have chosen in the wrong order try again" "Ok"endif ; rang != 1 closedendif ; activate closed this makes the script more effiecent, and at in the present state, well its like thisif i had pressed the first bell, and was looking for the second bell, and pressed the third bell, then nothing would happen and i could continue looking. this way, if i pressed the third bell when it was the second bells turn, i would have to start over. if this is what u want then leave the rang part how it was. and just move the OnActivate up also i would try moving the Set Rang to # to the top, this language is really particular, just try that, and if it still doesnt work come back here and tell me, and ill help u debug it. and if the variable works but the sound doesnt play, move the play sound up also. {to check if the variable worked, type If ( Rang == *what # it should be* ), then it should print a 1 to the console....i think....} Link to comment Share on other sites More sharing options...
Serrieth Posted January 9, 2004 Author Share Posted January 9, 2004 Thanks, I'll update my script, lets hope it does work. ;) Link to comment Share on other sites More sharing options...
Serrieth Posted January 11, 2004 Author Share Posted January 11, 2004 HELP! I hate this script right now and I do not understand why my game quits out...Can someone please explain why? Okay I have a code see and the code is in an object, ( Book ) and when the player gets the ( book ) the game quits out? here is the code for the object Begin SorinPapers; this script is to check to see that the player has a crime level that is more than 10; and checks that the player has had the document for more than three days and returns;Sorin back to balmora and has a clean up. float dayspassed ; number of days passedfloat xposfloat yposfloat zposshort Setup ; Values, 1 Off, 0 On, -1 STOP or Return.short cleanup ; cleans up the script and sets all of the values to 0 and setup to -1 if ( MenuMode == 1 ) returnendif if ( Player->Getitemcount ZZ_Sorin_papers >= 1 ) set setup to 0 ;starts script if the player has the paperselse set setup to -1endif if ( Setup == -1 ) returnendif if ( Setup == 0 ) Set dayspassed to Day ;every day the dayspassed is added by 1endif if ( cleanup == 1 ) Set xpos to 0 set ypos to 0 set xpos to 0 set dayspassed to 0 ; returns the days back to 0 set cleanup to 0 ;Stop clean up set Setup to -1 ;Set the value to STOP unless the PC has added the Documents again StopScript SorinPapersendif if ( GetPCCrimelevel > 10 ) Player->removeitem ZZ_Sorin_Papers 1 messagebox "Your crime level is higher than 10, the third law says that this document must be terminated." "Ok" set xpos to ( -21272.232 ) ; X set ypos to ( -17021.928 ) ; Y set zpos to ( 550.000 ) ; Z Removeitem ZZ_Bodyguard 1 Placeitem "ZZ_Bodyguard" xpos, ypos, zpos 0 ; Places Sorin in Balmora Set cleanup to 1 ;Start cleanup Set setup to 1 ;Stops counting the daysendif if ( dayspassed > 3 ) Player->removeitem ZZ_Sorin_Papers 1 messagebox "Sorry but your three days are up, sorin has returned to balmora and the papers are terminated." "Ok" set xpos to ( -21272.232 ) ; X set ypos to ( -17021.928 ) ; Y set zpos to ( 550.000 ) ; Z Removeitem ZZ_Bodyguard 1 Placeitem "ZZ_Bodyguard" xpos, ypos, zpos 0 ; Places Sorin in Balmora set Setup to 1 ;stop the days counting set cleanup to 1 ; starts clean upendif end This is for my Sorin bodyguard mod, I'm fixing it and making it better. Since I got lots of complaints that there were errors of the game crashing or they could not find sorin or they could not find the topic to hire sorin as a bodyguard. But thats beside the point. I neeed help :angry2: Link to comment Share on other sites More sharing options...
Serrieth Posted January 11, 2004 Author Share Posted January 11, 2004 Okay never mind for the Reply above I found a way to fix it, here it is :blush: I moved the Menu Mode to the top and made the line Set dayspassed to dayspassed + Day ;every day the dayspassed is 1 ? but the time of days is 3 count Begin SorinPapers; this script is to check to see that the player has a crime level that is more than 10; and checks that the player has had the document for more than three days and returns;Sorin back to balmora and has a clean up. if ( MenuMode == 1 ) return endif float dayspassed ; number of days passedfloat xposfloat yposfloat zposshort Setup ; Values, 1 Off, 0 On, -1 STOP or Return.short cleanup ; cleans up the script and sets all of the values to 0 and setup to -1 if ( Player->Getitemcount ZZ_Sorin_papers >= 1 ) set setup to 0 ;starts script if the player has the paperselse set setup to -1endif if ( Setup == -1 ) returnendif if ( Setup == 0 ) Set dayspassed to dayspassed + Day ;every day the dayspassed is added by 1endif if ( cleanup == 1 ) Set xpos to 0 set ypos to 0 set xpos to 0 set dayspassed to 0 ; returns the days back to 0 set cleanup to 0 ;Stop clean up set Setup to -1 ;Set the value to STOP unless the PC has added the Documents again StopScript SorinPapersendif if ( GetPCCrimelevel > 10 ) Player->removeitem ZZ_Sorin_Papers 1 messagebox "Your crime level is higher than 10, the third law says that this document must be terminated." "Ok" set xpos to ( -21272.232 ) ; X set ypos to ( -17021.928 ) ; Y set zpos to ( 550.000 ) ; Z Removeitem ZZ_Bodyguard 1 Placeitem "ZZ_Bodyguard" xpos, ypos, zpos 0 ; Places Sorin in Balmora Set cleanup to 1 ;Start cleanup Set setup to 1 ;Stops counting the daysendif if ( dayspassed > 3 ) Player->removeitem ZZ_Sorin_Papers 1 messagebox "Sorry but your three days are up, sorin has returned to balmora and the papers are terminated." "Ok" set xpos to ( -21272.232 ) ; X set ypos to ( -17021.928 ) ; Y set zpos to ( 550.000 ) ; Z Removeitem ZZ_Bodyguard 1 Placeitem "ZZ_Bodyguard" xpos, ypos, zpos 0 ; Places Sorin in Balmora set Setup to 1 ;stop the days counting set cleanup to 1 ; starts clean upendif end But I have another problem!!!!!!!!!!! The day and dayspassed don't seem to work right. As you see in...(Set dayspassed to dayspassed + Day ;every day the dayspassed is 1?)the game will then see to that dayspassed then == 3 or more and restarts the script as its suppost to do, but there are suppost to be three days count to have the bodyguard?! :huh: My question is, how do I make a timer that goes with the days? :help: :help: Link to comment Share on other sites More sharing options...
Lord Of The Cheese Posted January 11, 2004 Share Posted January 11, 2004 try using "GetDaysPassed" as it says, it gets the days number of days passed since the start of the game then u will have to add this: short StartDay If ( setup == 0 )set StartDay to GetDaysPassedset setup to 1endif if ( setup == 1 )set DaysPassed to ( GetDaysPassed - StartDay)endif try that and see if that works better Link to comment Share on other sites More sharing options...
Lord Of The Cheese Posted January 12, 2004 Share Posted January 12, 2004 ur problem with day is that day starts out at 16, try this that i got from scripting for dummies: short currentday If ( setup == 0 )If ( currentday != Day )set currentday to Dayset dayspassed to ( dayspassed + 1 )endifendif Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.