Jump to content
  • We need you!

    You must register to discover all the features of our community!

  • 0

Problem with a little function in quest


Zoom

Question

 

Hi, i have a problem with "if" in my quest.

 

This quest looks like:

 

when xxx.use begin

 

[...]

 

if pc.get_skill_group() != 1 and pc.get_job() != 0 or pc.get_job() != 4 then
    syschat("["..item.get_name().."]".." you are not a warrior body")
    return

end

 

Translate: When im not a BODY and WARRIOR MEN or WOMAN, return...

but when i try use item on warrior with skills BODY, i got syschat "you are not a warrior body"

 

Really i don't know why this doesn't work, this is a simple function, somebody have idea whats wrong?

 

Best regards.

 

Link to post

4 answers to this question

Recommended Posts

  • 0
quest test begin
	state start begin
		when login begin
			set_state(information)
		end
	end
	state information begin
		when letter begin
			send_letter("Test")
		end
		when button or info begin
			if pc.get_skill_group() == 1 and pc.get_job() == 0 or pc.get_job() == 4 then
				say_title("Test")
				say("")
				say("You are a warrior body. (man/woman)")
				say("")
				clear_letter()
			else
				say_title("Test")
				say("")
				say("You are not a warrior body. (man/woman)")
				say("")
				clear_letter()
			end
		end
	end
end
if not pc.get_skill_group() == 1 and pc.get_job() == 0 or pc.get_job() == 4 then
	syschat("["..item.get_name().."]".." you are not a warrior body")
	return
end
quest test2 begin
	state start begin
		when login begin
			set_state(information)
		end
	end
	state information begin
		when letter begin
			send_letter("Test2")
		end
		when button or info begin
			if not pc.get_skill_group() == 1 and pc.get_job() == 0 or pc.get_job() == 4 then
				say_title("Test2")
				say("")
				say("You are not a warrior body. (man/woman)")
				say("")
				clear_letter()
			else
				say_title("Test2")
				say("")
				say("You are a warrior body. (man/woman)")
				say("")
				clear_letter()
			end
		end
	end
end

 

Edited by Cunoo (see edit history)
Link to post
  • 0

@Cunoo

 

When i change my line of "if" to "if not pc.get_skill_group() == 1 and pc.get_job()== 0 or pc.get_job() == 4 then

i doesn't work, when i change pc.get_skill_group() == 1 to pc.get_skill_group() == 2 (MENTAL) i can use item.

 

Thanks for quests but in my case i can't use like this:

 

if bla bla

   bla bla

else <---- with else

  bla bla

 

I have to include this "if" to this list:

 

when xxx.use begin

 

if pc.get_skill_group() == 0 then
                syschat("...")
                return
            end

if table.getn(vnum_list) == 0 then
                syschat("...")
                return
            end
            
if pc.count_item(50513) == 0 then
                syschat("..")
                return
            end
            
 if not pc.can_warp() then
                syschat("..")
                return
            end

 

----- HERE TO SPEACE FOR IF --

 

"if" must end with return end :)

Link to post
  • 0
  • VIP
1 hour ago, Zoom said:

@Cunoo

 

When i change my line of "if" to "if not pc.get_skill_group() == 1 and pc.get_job()== 0 or pc.get_job() == 4 then

i doesn't work, when i change pc.get_skill_group() == 1 to pc.get_skill_group() == 2 (MENTAL) i can use item.

 

Thanks for quests but in my case i can't use like this:

 

if bla bla

   bla bla

else <---- with else

  bla bla

 

I have to include this "if" to this list:

 

when xxx.use begin

 

if pc.get_skill_group() == 0 then
                syschat("...")
                return
            end

if table.getn(vnum_list) == 0 then
                syschat("...")
                return
            end
            
if pc.count_item(50513) == 0 then
                syschat("..")
                return
            end
            
 if not pc.can_warp() then
                syschat("..")
                return
            end

 

----- HERE TO SPEACE FOR IF --

 

"if" must end with return end :)

weed GIF

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.