manbearpig Posted May 1, 2009 Author Share Posted May 1, 2009 Sub hobo(index)If GetVar("FLAGS.ini", GetPlayerName(index), "Flag1") = 0 ThenCall RaiseFlag(Index, 1, 1)Call BattleMsg(index,"Hobo: Thank you!", 4, 0)End IfIf GetVar("FLAGS.ini", GetPlayerName(index), "Flag1") = 1 ThenCall BattleMsg(index,"Hobo: Please, can you get me a salmon to eat ? i can pay you back!", 4, 0)Call TakeItem(index, 32)Call GiveItem(index, 1, 100)Call LowerFlag(Index, 1, 1)End IfEnd SubTHis is just a simple quest"im a hobo i need food blah.."* brings food*"here you go"* gets item *–-----------SO how should a scripted tile look like for this case 0 and where do i put the main script that i have here? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted May 2, 2009 Share Posted May 2, 2009 Okay; first off, do you have the RaiseFlag, LowerFlag, TakeItem, and GiveItem in your main.txt?If not, you'll have to add them (I'm assuming you do have them, since you called them in your script).Now, to actually use this, paste it at the bottom of your main.txt, and under Case 0 for the scripted sub, just put:Case 0 Call hobo(index) Exit Sub Link to comment Share on other sites More sharing options...
manbearpig Posted May 2, 2009 Author Share Posted May 2, 2009 i get some error like something that says "Strings Link to comment Share on other sites More sharing options...
Admiral Refuge Posted May 2, 2009 Share Posted May 2, 2009 @manbearpig:> i get some error like something that says "StringsWhat exactly does the error say? Link to comment Share on other sites More sharing options...
manbearpig Posted May 2, 2009 Author Share Posted May 2, 2009 GOT IT! well i didnot fix it… but it was like Type: Type mismatch: '[string: ''''']' Link to comment Share on other sites More sharing options...
Fruitpunch Posted May 2, 2009 Share Posted May 2, 2009 you need to put & "" after functions when they are returning strings Link to comment Share on other sites More sharing options...
Admiral Refuge Posted May 2, 2009 Share Posted May 2, 2009 @Fruitpunch:> you need to put & "" after functions when they are returning stringsWhat, the GetVar and stuff?Or he could call them like this:If Int(GetVar("FLAGS.ini", GetPlayerName(index), "Flag1")) = 0 Then Link to comment Share on other sites More sharing options...
Fruitpunch Posted May 2, 2009 Share Posted May 2, 2009 @Ã…ÃÂüiÑÂôζ:> What, the GetVar and stuff?> Or he could call them like this:> If Int(GetVar("FLAGS.ini", GetPlayerName(index), "Flag1")) = 0 Thenyeah…well I prefer to do the & "" way Link to comment Share on other sites More sharing options...
manbearpig Posted May 2, 2009 Author Share Posted May 2, 2009 Soooo..Sub hobo(index)If Int(GetVar("FLAGS.ini", GetPlayerName(index), "Flag1")) = 0 ThenCall RaiseFlag(Index, 1, 1)Call BattleMsg(index,"Hobo: Thank you!", 4, 0)End IfIf GetVar("FLAGS.ini", GetPlayerName(index), "Flag1") = 1 ThenCall BattleMsg(index,"Hobo: Please, can you get me a salmon to eat ? i can pay you back!", 4, 0)Call TakeItem(index, 32)Call GiveItem(index, 1, 100)Call LowerFlag(Index, 1, 1)End IfEnd Sub Link to comment Share on other sites More sharing options...
manbearpig Posted May 2, 2009 Author Share Posted May 2, 2009 Aww doesnt work =((*double chin* Link to comment Share on other sites More sharing options...
Admiral Refuge Posted May 2, 2009 Share Posted May 2, 2009 @manbearpig:> Aww doesnt work =((*double chin*You need to do it for everything that returns a string, eg both GetVar functions =/Also, you have a logical error in your script, but let's see if it can atleast work first ;)EDIT:Or, you could just send it back as a string, eg:If GetVar("FLAGS.ini", GetPlayerName(index), "Flag1") = "0" ThenEDIT 2: Oh, and you're calling the INI wrong also; it should be:If GetVar("FLAGS.ini", "" & GetPlayerName(index) & "", "Flag1") = "0" ThenorIf Int(GetVar("FLAGS.ini", "" & GetPlayerName(index) & "", "Flag1")) = 0 Then Link to comment Share on other sites More sharing options...
manbearpig Posted May 2, 2009 Author Share Posted May 2, 2009 im such a noob so can any one just post a new main but with my script aded to it so i can learn what to do and so i wont have this mistake again? Link to comment Share on other sites More sharing options...
Bobosk Posted May 2, 2009 Share Posted May 2, 2009 Sub TakeItem(Index, Number, Amount)…you're only putting one var for TakeItem... Link to comment Share on other sites More sharing options...
Admiral Refuge Posted May 2, 2009 Share Posted May 2, 2009 @manbearpig:> im such a noob so can any one just post a new main but with my script aded to it so i can learn what to do and so i wont have this mistake again?It's not a mistake in installing it, it's a mistake in the syntax.Now, when the Getvar gets something from an ini, it returns a strong, not a number. You're trying to get it to read 0 or 1 as numbers, when you should get it to read 0 or 1 as strings (with strings, they need to be in quotes).Now, what you can do, is simply have the 0 and 1 in double-quotes (eg, "0", "1").Your second error, was when calling the GetVar in the first place:If GetVar("FLAGS.ini", **GetPlayerName(index)**, "Flag1") ThenIt needs to accept three strings, but you only have two (notice the quotes in the two arguments, but not the one in the middle).To overcome this, you can use the "&", to attach the string like so:If GetVar("FLAGS.ini", **"" & GetPlayerName(index) & ""**, "Flag1") ThenThat should work.But please notice; you are using GetVar twice, to get two differnet values from the ini; if you look at the script you re-posted, you only changed the first one.SO, the working script (assuming other syntax,and logic is correct), should be as follows (there are two methods, one with Int() and one without Int(), both should work, but look at them both to see what you did wrong):> Sub hobo(index)> If Int(GetVar("FLAGS.ini", GetPlayerName(index), "Flag1")) = 0 Then> Call RaiseFlag(Index, 1, 1)> Call BattleMsg(index,"Hobo: Thank you!", 4, 0)> End If> If Int(GetVar("FLAGS.ini", GetPlayerName(index), "Flag1")) = 1 Then> Call BattleMsg(index,"Hobo: Please, can you get me a salmon to eat ? i can pay you back!", 4, 0)> Call TakeItem(index, 32)> Call GiveItem(index, 1, 100)> Call LowerFlag(Index, 1, 1)> End If> End SubOr:> Sub hobo(index)> If GetVar("FLAGS.ini", GetPlayerName(index), "Flag1") = "0" Then> Call RaiseFlag(Index, 1, 1)> Call BattleMsg(index,"Hobo: Thank you!", 4, 0)> End If> If GetVar("FLAGS.ini", GetPlayerName(index), "Flag1") = "1" Then> Call BattleMsg(index,"Hobo: Please, can you get me a salmon to eat ? i can pay you back!", 4, 0)> Call TakeItem(index, 32)> Call GiveItem(index, 1, 100)> Call LowerFlag(Index, 1, 1)> End If> End SubAlso, as I asked before, you did install the RaiseFlag, LowerFlag, TakeItem, and GiveItem subs in your main.txt, right?Warning - while you were typing a new reply has been posted. You may wish to review your post.I haven't even noticed that he was calling the TakeItem wrong, then he probably didn't install the subs Link to comment Share on other sites More sharing options...
manbearpig Posted May 2, 2009 Author Share Posted May 2, 2009 nope. Link to comment Share on other sites More sharing options...
Admiral Refuge Posted May 2, 2009 Share Posted May 2, 2009 @manbearpig:> nope.Why would you Call LowerFlag, if you don't even have it?Go find those functions and subs, and install them into your main.txt (I'm not sure where they would be)Though, it looks like you used that random generator for making scripts; it's not the best, and it doesn't provide the functions or anything (it also calls the functions incorrectly).I'd recommend you get a basic understanding of scripting, and read up on some quest tutorials; because what you're trying to accomplish can be done alot easier if scripted manuallyEDIT: I found the raise/lower flag subs; not sure if they are the ones that script uses, so check the arguments and make sure they match up: http://www.touchofdeathforums.com/smf/index.php?topic=7014.0 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now