Page 1 of 1
I need a little help with scripting
Posted: November 13th, 2010, 4:22 pm
by Dial3ct
can someone tell me why this code isnt working? and if you can.. can you post a fixed version of it
Code: Select all
level_trigger_1 = [showgui George]
newgui George [
guitext "Hello! I'm George. How are you?"
guibar
guibutton "I'm great! How are you?" [
guitext "Good. I'm good too. Have you got time?" [
guibutton "Yes!Why?"[
guitext "You see my wife down there? Yes, well she's hiding something from me. Could you find out for me? Thanks" [
guibutton "Yes!"[cleargui]
guibutton "Sorry, I have to go!"[cleargui]]
guibutton "No, sorry I have to go now."[cleargui]]]
guibutton "Sorry! I have to go!" [cleargui]]
guibutton "I found out what you wanted me to!" [
guitext "Great! What is it?" [
guibutton "She's having an affair!"[echo "That's sweet evil lies!"][cleargui]
guibutton "She's a secret ninja!" [echo "I know that!"][cleargui]
guibutton "She really wants to be a chef but feels you're holding her back." [
guitext "Really. I'm bad! But on the other hand at least it isnt anything worse!" [cleargui]]]
Re: I need a little help with scripting
Posted: November 13th, 2010, 5:43 pm
by chocolatepie33
What you should do is use the guibuttons to create a new menu with the proper text. So it'd be something like this:
Code: Select all
on_start = [
infofound1 = 0
]
level_trigger_1 = [if ( > 0 $infofound 1 ) [showgui npc 2-1] ; showgui npc1-1]
newgui npc1-1 [
guitext "Hi, I'm George, how are you?"
guibar
guibutton "Fine, thank you. How are you?" [showgui npc1-2]
] "George"
newgui npc1-2 [
guitext "I'm fine myself, thanks. Do you have any free time?"
guibar
guibutton "Yes, why?" [showgui npc1-3]
guibutton "I'm sorry, I don't." [cleargui]
] "George:
newgui npc1-3 [
guitext "I think my wife's hiding something from me. Can you find out what it is?"
guibar
guibutton "Sure, I'll try." [cleargui]
guibutton "I don't know... Probably not." [cleargui]
] "George"
newgui npc2-1 [
guitext "So, did you find the information?"
guibar
guibutton "yes, I did." [showgui npc2-2]
] "George"
newgui npc2-2 [
guitext "Great! What is it?"
guibar
guibutton "She's having an affair." [ echo "YOU LIAR!" ; cleargui ]
guibutton "She's secretly a ninja!" [ echo "I knew that." ; cleargui ]
guibutton "She really wants to be a chef, but you're holding her back." [showgui npc2-3]
] "George"
newgui npc2-3 [
guitext "Well, that's not so bad, is it?"
guibar
guibutton "I guess not..." [cleargui]
] "George"
Something you should never do is this: [echo "That's sweet evil lies!"][cleargui] because a guibutton or guitext has this kind of format:
guitext "Title" [icon]
guibutton "Title" [action] [icon]
what you would've done is that there wouldn't be a button, just a bad-looking "No texture" box.
also, you don't need [ after guitext, or ] after the commands of a guibutton.
Re: I need a little help with scripting
Posted: November 14th, 2010, 2:05 pm
by Dial3ct
thanks a mill! so if i was to have a lot of people in the town and when you approach them there is a long convo do i need to do anything with
btw does that mean when i go to the wife do i need to have
when you find out off the wife.
btw is that how you do quests?
Re: I need a little help with scripting
Posted: November 14th, 2010, 4:08 pm
by chocolatepie33
Basically, that's kind of how you do quests, it's a lot more of that though, I have an unfinished .cfg file that's 7KB, which is pretty long.
The deal is, using infofound1 determines what conversation you have with George. when you talk to his wife, you add a unit of infofound1, making it possible to talk to George with the 2nd conversation, since you need more than 0 infofound1s to talk to him the 2nd time. Get what I mean?
Re: I need a little help with scripting
Posted: November 14th, 2010, 4:11 pm
by Dial3ct
ok this is my code now:
Code: Select all
on_start = [
infofound1 = 0
money = 0
]
level_trigger_1 = [if ( > 0 $infofound 1 ) [showgui npc2-1] ; showgui npc1-1]
newgui npc1-1 [
guitext "Hi, I'm George, how are you?"
guibar
guibutton "Fine, thank you. How are you?" [showgui npc1-2]
] "George"
newgui npc1-2 [
guitext "I'm fine myself, thanks. Do you have any free time?"
guibar
guibutton "Yes, why?" [showgui npc1-3]
guibutton "I'm sorry, I don't." [cleargui]
] "George:
newgui npc1-3 [
guitext "I think my wife's hiding something from me. Can you find out what it is?"
guibar
guibutton "Sure, I'll try." [cleargui]
guibutton "I don't know... Probably not." [cleargui]
] "George"
newgui npc2-1 [
guitext "So, did you find the information?"
guibar
guibutton "yes, I did." [showgui npc2-2]
] "George"
newgui npc2-2 [
guitext "Great! What is it?"
guibar
guibutton "She's having an affair." [ echo "YOU LIAR!" ; cleargui ]
guibutton "She's secretly a ninja!" [ echo "I knew that." ; cleargui ]
guibutton "She really wants to be a chef, but you're holding her back." [showgui npc2-3]
] "George"
newgui npc2-3 [
guitext "Well, that's not so bad, is it?"
guibar
guibutton "I guess not..." [cleargui]
] "George"
level_trigger_2 = [showgui npc3-1]
newgui npc3-1 [
guitext "Hello, there. Is there anything you wanted?"
guibar
guibutton "Awk... Just a chat." [showgui npc3-2]
] "Michelle"
newgui npc3-2 [
guitext "Oh, alright. Did you know I am a ninja? Secretly of course! Don't give me that look I'm telling the truth."
guibar
guibutton "Haha I believe you! There must be another secret but..." [showgui npc3-3]
guibutton "Sorry, I have to go!"[cleargui]
] "Michelle:
newgui npc3-3 [
guitext "Aha... There is but how do I know I can trust you!!?"
guibar
guibutton "Believe me there will not be four people who know it!" [showgui npc3-4]
guibutton "You can't see ya!" [cleargui]
] "Michelle"
newgui npc3-4 [
guitext "Ok, I have always wanted to be a chef but my husband is holding me back!" [infofound1 = ($infofound1 1)]
guibar
guibutton "You should try it anyway." [showgui npc3-5]
guibutton "Oh right... Gotta go."[cleargui]
] "Michelle"
newgui npc3-5 [
guitext "Yes you know what i will. Here's 5 gold for listening to my troubles!!" [money = (+ $money 5); cleargui]
] "Michelle"
newgui main [
guilist [
guilist [
guitext (format "Money: %1" $money)
]
]
guibar
@main
]
the bits i'm having problems with is:
and
does anyone know where i'm going wrong? and could they explain it to me
Re: I need a little help with scripting
Posted: November 14th, 2010, 4:18 pm
by chocolatepie33
1. You're making an action for guitext. You can only make actions for guibuttons. Remember the format stuff I told you earlier?
2. You need a + for infofound1, exactly like you did with money, though.
Re: I need a little help with scripting
Posted: November 14th, 2010, 4:25 pm
by Dial3ct
so... should i change guitext to echo??
naw that isnt right...
err... help???
should i just put the info and money in with the guibutton that corresponds to it?
Re: I need a little help with scripting
Posted: November 14th, 2010, 4:35 pm
by Dial3ct
would i be right in saying this'll do the trick?
Code: Select all
newgui npc3-3 [
guitext "Aha... There is but how do I know I can trust you!!?"
guibar
guibutton "Believe me there will not be four people who know it!" [infofound1 = (+ $infofound1 1); showgui npc3-4]
guibutton "You can't see ya!" [cleargui]
] "Michelle"
newgui npc3-4 [
guitext "Ok, I have always wanted to be a chef but my husband is holding me back!"
guibar
guibutton "You should try it anyway." [money = (+ $money 5); showgui npc3-5]
guibutton "Oh right... Gotta go."[cleargui]
] "Michelle"
newgui npc3-5 [
guitext "Yes you know what i will. Here's 5 gold for listening to my troubles!!" [cleargui]
] "Michelle"
Re: I need a little help with scripting
Posted: November 14th, 2010, 4:40 pm
by Dial3ct
Code: Select all
guitext "Yes you know what i will. Here's 5 gold for listening to my troubles!!" [cleargui]
should be
Code: Select all
guitext "Yes you know what i will. Here's 5 gold for listening to my troubles!!"
guibar
guibutton "Bye" [cleargui]
Re: I need a little help with scripting
Posted: November 14th, 2010, 4:52 pm
by Dial3ct
errr......!!!
now the infofound to show the second convo isnt working!
Code: Select all
level_trigger_1 = [if ( $infofound = 1) [showgui npc2-1] ; showgui npc1-1]
i even change the code to ^ to try and see if it would work but naw it dont.
the full code
Code: Select all
on_start = [
infofound = 0
money = 0
]
level_trigger_1 = [if ( $infofound = 1) [showgui npc2-1] ; showgui npc1-1]
newgui npc1-1 [
guitext "Hi, I'm George, how are you?"
guibar
guibutton "Fine, thank you. How are you?" [showgui npc1-2]
] "George"
newgui npc1-2 [
guitext "I'm fine myself, thanks. Do you have any free time?"
guibar
guibutton "Yes, why?" [showgui npc1-3]
guibutton "I'm sorry, I don't." [cleargui]
] "George:
newgui npc1-3 [
guitext "I think my wife's hiding something from me. Can you find out what it is?"
guibar
guibutton "Sure, I'll try." [cleargui]
guibutton "I don't know... Probably not." [cleargui]
] "George"
newgui npc2-1 [
guitext "So, did you find the information?"
guibar
guibutton "yes, I did." [showgui npc2-2]
] "George"
newgui npc2-2 [
guitext "Great! What is it?"
guibar
guibutton "She's having an affair." [ echo "YOU LIAR!" ; cleargui ]
guibutton "She's secretly a ninja!" [ echo "I knew that." ; cleargui ]
guibutton "She really wants to be a chef, but you're holding her back." [showgui npc2-3]
] "George"
newgui npc2-3 [
guitext "Well, that's not so bad, is it?"
guibar
guibutton "I guess not..." [cleargui]
] "George"
level_trigger_2 = [showgui npc3-1]
newgui npc3-1 [
guitext "Hello, there. Is there anything you wanted?"
guibar
guibutton "Awk... Just a chat." [showgui npc3-2]
] "Michelle"
newgui npc3-2 [
guitext "Oh, alright. Did you know I am a ninja? Secretly of course! Don't give me that look I'm telling the truth."
guibar
guibutton "Haha I believe you! There must be another secret but..." [showgui npc3-3]
guibutton "Sorry, I have to go!"[cleargui]
] "Michelle:
newgui npc3-3 [
guitext "Aha... There is but how do I know I can trust you!!?"
guibar
guibutton "Believe me there will not be four people who know it!" [infofound = (+ $infofound 1); showgui npc3-4]
guibutton "You can't see ya!" [cleargui]
] "Michelle"
newgui npc3-4 [
guitext "Ok, I have always wanted to be a chef but my husband is holding me back!"
guibar
guibutton "You should try it anyway." [money = (+ $money 5); showgui npc3-5]
guibutton "Oh right... Gotta go."[cleargui]
] "Michelle"
newgui npc3-5 [
guitext "Yes you know what i will. Here's 5 gold for listening to my troubles!!"
guibar
guibutton "Bye" [cleargui]
] "Michelle"
newgui main [
guilist [
guilist [
guitext (format "Money: %1" $money)
]
]
guibar
@main
]