Jump to content
  • 0

Is there a way to compress this ?


Rain408

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   0
  • Joined:  05/23/15
  • Last Seen:  

	if (checkquest(60520) != -1) {
	if (checkquest(60521) != -1) {
	if (checkquest(60518) != -1) {

Is there a way to compress it so i dont have to type the same thing over and over, and risk messing up with my else.....

Because the code just looks ugly like that

 

I was thinking it could look something like this.

 

if (checkquest(60520 ll 60521 ll 60518) != -1) {
 
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  545
  • Reputation:   220
  • Joined:  03/01/13
  • Last Seen:  

	if (checkquest(60520) != -1) {
	if (checkquest(60521) != -1) {
	if (checkquest(60518) != -1) {

Is there a way to compress it so i dont have to type the same thing over and over, and risk messing up with my else.....

Because the code just looks ugly like that

 

 
if (checkquest(60520) != -1 || (60521) != -1 || (60518) != -1)) {

Should work fine; Not entirely sure it looks better this way, but if that is what you want to do. Actually looking at my own use of a similar format, it looks nice in script editor.  /ok 

B6jqFnp.png

 

Important side note.. in your post, when scripting 'or' ||

You use 'll' <- two lower case L's.

You need to use '||' <- two shift+\

Regards,

~Azura Skyy

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   0
  • Joined:  05/23/15
  • Last Seen:  

 

	if (checkquest(60520) != -1) {
	if (checkquest(60521) != -1) {
	if (checkquest(60518) != -1) {

Is there a way to compress it so i dont have to type the same thing over and over, and risk messing up with my else.....

Because the code just looks ugly like that

 

 
if (checkquest(60520) != -1 || (60521) != -1 || (60518) != -1)) {

Should work fine; Not entirely sure it looks better this way, but if that is what you want to do. Actually looking at my own use of a similar format, it looks nice in script editor.  /ok

B6jqFnp.png

 

Important side note.. in your post, when scripting 'or' ||

You use 'll' <- two lower case L's.

You need to use '||' <- two shift+\

Regards,

~Azura Skyy

 

 

Thank you. I had a couple question about your script.

 

Checkquest(60520)= = 2 , why you set it equal to 2?

 

Next question is if ($Questleve >0), what does that command do?

 

I'm just curious to learn these things so I can become a better scripter.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  545
  • Reputation:   220
  • Joined:  03/01/13
  • Last Seen:  

Thank you. I had a couple question about your script.

 

Checkquest(60520)= = 2 , why you set it equal to 2?

 

Next question is if ($Questleve >0), what does that command do?

 

I'm just curious to learn these things so I can become a better scripter.

 

 

Checking if a quest == 2 is just a check to make sure the quest is completed. The $Questlevel variable is my own variable in that script, whereby if it is set to 1, the script requires that players meet the base level requirement to do the quest (the full script is a quest skipper, so... toggles for level and item requirements). Not important to your situation I think. If you want to read more about variables, click here.

Regards,

~Azura Skyy

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...