Jump to content

Photo

Yes/No Question Script


  • Please log in to reply
8 replies to this topic

#1 AgentLym

AgentLym

    • Zelda and Pokémon Master •

  • Members
  • Location:Skyloft

Posted 10 July 2009 - 12:58 PM

Has anyone created a script yet for a 'Yes/No' answer... thingy? Like, so... Well, here's some of my topic starter in Scripting Discussion:

QUOTE
Ok, here's my idea in full, no interruptions:

1) Make a custom item with a counter value of '0'
2) Go to the String Editor and open up the string with the Yes/No question
3) Use the '\12\X\X' function in the String Editor to change the custom item's counter value you created to '1'
4) Once that string goes off the screen (with the 'Messages Disappear' rule checked), the Script you have created will load a large FFC that looks like a text box with the Yes and No text in it (but in fact, the Yes and No will be only part of the FFC the script as loaded, and is not really a text, or text box for that matter, at all)
5) The player chooses the answer he wants to use (with an arrow or something, scripted, of course)
6) The script changes the counter value of the custom item to '0' again, and displays the string relative to the choice the player has chosen

Now, how will this script work? I think I may know. First, your script will have 3 arguments: One for the FFC, one for the string of the Yes answer, and one for the string of the No answer. The script will recognize when the counter of 'custom item' is over '0', and bring up the FFC (that looks like a normal text box with the text Yes and No already drawn inside). Then, the script will freeze all motion of the game, and place an arrow that will be in front of Yes until the player pushes 'Up' or 'Down' on the arrow keys, then the arrow will be placed in front of No. (like the player is selecting an answer)

Once the player hits Enter (or whatever the input key is), the script will read which answer the arrow was in front of, clear the FFC, and display the correct String!


Is that possible? Can you even give a custom item an actual counter value? (so I don't have to use rupees or bombs or anything like that)

Also, so it'll be more customizable, make it look like this and the arrow moves up and down (if you decide to jump right in... icon_razz.gif):

/////////////////////////////////////////////////////////////////
///// --> Yes //////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
////////// No ///////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////

That way, you could also have this, depending on how you draw your tiles used for your FFC:

/////////////////////////////////////////////////////////////////
///// --> Sword of Destruction /////////////////////////////
//////////////////////////////////////////////////////////////////
////////// Shield of Protection ///////////////////////////////
/////////////////////////////////////////////////////////////////

And you could have a string for each that would give you a special item or such! Here's a smidgen of code I made (just for convenience's sake icon_razz.gif):

CODE
ffc script Yes_No
{
    void run(int textbox, int onestring, int twostring)
    {
        while(true)
        {
if(itemclass->Counter(7) > 0)
{
    


}
        Waitframe();
        }
    }
}

Where 'textbox' is the Tile for the FFC, 'onestring' is the number of the string to be played if the first answer is chosen, and 'twostring' is the string to be chosen if the second answer is chosen. Hope that might help! (that's as far as I got icon_razz.gif) Make sure to make the ''Arrow of Choice's" placement be relative to the coordinates of the FFC! Thanks, all!

NOTE: I updated 'std.zh' with:

CODE
//Itemclass counters. Use with itemclass->Counter
const int CR_RUPEES             = 1;
const int CR_BOMBS              = 2;
const int CR_ARROWS             = 3;
const int CR_MAGIC              = 4;
const int CR_KEYS               = 5;
const int CR_SBOMBS             = 6;
//======================================================================
const int CR_YESNO              = 7;
//======================================================================

But I am almost positive that's not how ZQuest works... Any suggestions? I thought that might work because the String Editor uses std.zh, right? So you'd put '\12\7\1'... wouldn't that work?

Edited by AgentLym, 10 July 2009 - 01:02 PM.


#2 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 14 July 2009 - 12:42 PM

i think this might be possible with a drawtile function and checking whether the player presses down or up, playing an sfx for the cursor, and an sfx when you actually select an answer.

Also checking after a string i.d is played to display the ffc.

Joe123's Mouse-Click Button Script might be useful for this too i suppose.

I might give this a go for some practice, but i'm so darn lazy that i feel like eating fried chicken all day while i watch TV icon_smile.gif

Edited by Christian, 14 July 2009 - 12:43 PM.


#3 Joe123

Joe123

    Retired

  • Members

Posted 14 July 2009 - 01:40 PM

QUOTE(AgentLym @ Jul 10 2009, 06:58 PM) View Post
But I am almost positive that's not how ZQuest works...


No, it's not.

Somewhere lurking around the code there'll be an array a bit like this (not sure exactly where it is):
CODE
int GameCounters[7];

Which is the right size for storing all of the current counters, but you can't pass in any more than that.
So what it looks like in the ffc script interpreter code is a little like this (except with ASM because that's how the interpreter works):
CODE
case Game->Counter[]:
{
     if(element >= 0 && element <= 6) GameCounters[element] = value;
}


Admittedly it's not a huge amount like that, but that's general idea.

#4 Joe123

Joe123

    Retired

  • Members

Posted 16 July 2009 - 01:34 PM

On further inspection of the source code, there are actually 32 game counters hiding away in the array, not 7.
So what you wanted to do might work.

#5 AgentLym

AgentLym

    • Zelda and Pokémon Master •

  • Members
  • Location:Skyloft

Posted 16 July 2009 - 03:10 PM

Oh neato! But, by messing with Counter 7, I wouldn't be messing with anything running 'under-the-hood', right? Like, maybe Counter 7 is the dmap Link is on or something, and if I change it, I'd mess up the game? Nothing like that, right?

And, I could use a little bit more help on the code itself, if it's not too much trouble. icon_heh.gif But that 'request' isn't limited to Joe123, btw! icon_razz.gif

#6 Joe123

Joe123

    Retired

  • Members

Posted 16 July 2009 - 03:31 PM

QUOTE(AgentLym @ Jul 16 2009, 09:10 PM) View Post
Oh neato! But, by messing with Counter 7, I wouldn't be messing with anything running 'under-the-hood', right? Like, maybe Counter 7 is the dmap Link is on or something, and if I change it, I'd mess up the game? Nothing like that, right?

Oh actually the script interpreter might have element <= 6, I'll check that for you later.
I don't know whether the counters above 6 are used because I don't fancy trawling through the whole of the source, but in the source it says:
CODE
    word _counters[32]; //0- Life, 1- Rupees etc. up to 6- Super Bombs

So I'd guess we're reasonably safe to assume they're not used. It's the sort of thing where they're probably 'reserved for future usage'.
I'm pondering on the idea of implementing some custom counters reasonably soon, so when I've done that it'll use 7-12 I'd guess.
After I do that (if I do that) you could definately use it.

QUOTE(AgentLym @ Jul 16 2009, 09:10 PM) View Post
And, I could use a little bit more help on the code itself, if it's not too much trouble. icon_heh.gif

I'm quite happy to lend you a hand if you want to write some yourself but I'm not writing it all.
I didn't actually read through your explanation of how it might work though, I'm just talking about using Game->Counter[7] at the moment.

Just incase you were wondering, we have
CODE
typedef unsigned short int word;

hiding away in the source.

#7 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 17 July 2009 - 04:32 PM

I prefer the always hilarious

CODE
typedef unsigned long int poop;

and
CODE
#define string      pee


myself. icon_freak.gif

#8 Joe123

Joe123

    Retired

  • Members

Posted 17 July 2009 - 04:33 PM

hehe =P

Although, unless you're trying to amuse the compiler,
CODE
#define pee string

Is probably more amusing =P

#9 AgentLym

AgentLym

    • Zelda and Pokémon Master •

  • Members
  • Location:Skyloft

Posted 17 July 2009 - 08:07 PM

Eh, ok then! lol Does the 'poop' and 'pee' actually reference something?! icon_heh.gif

But, yeah, I'll try to script a little somethin', but I don't think I'll get to it tonight. Maybe tomorrow, maybe not; this'll probably be a kind of ordeal for me, 'cause I have no idea quite of what I'm doing, but... yeah.

Thanks for all the help, though, Joe!


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users