Jump to content

Photo

Message String on Combo


  • Please log in to reply
7 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 07 March 2012 - 02:51 PM

Could somebody please make a script which displays a specified message string (one argument)
anytime a specified combo (the other argument) is on the screen?

Also, I want the string to be triggered only by the appearance of the combo.
If the combo stays on the screen, I don't want the string to keep playing over and over.

Many thanks if you can help. icon_smile.gif

#2 Kite

Kite

    ???

  • Members

Posted 07 March 2012 - 04:19 PM

I haven't tested this very thoroughly, but here is a ffc script I came up with.

Edit: This only checks layer 0. D0 is the string and D1 is the number of the combo to check for. This uses a function from std.zh, so make sure you have that imported if you don't already.

CODE
import "std.zh"

// This will check for the specified combo.
// If found, it will play a message.
// If the combo disappears, the check for the combo will reset.
// d0 = String
// d1 = Number of the combo to check for
ffc script comboString
{
    void run(int string, int combo)
    {
        bool hasAppeared = false;
        // Enter the main loop
        while(true)
        {
            // If the combo has not appeared, loop through this while loop...
            while(!hasAppeared)
            {
                // Check if there is an instance of the combo on the screen...
                if(FirstComboOf(combo, 0) != -1)
                {
                    hasAppeared = true;
                    Screen->Message(string); // Play the message.
                }
                Waitframe();
            }
            // If the combo has appeared, loop through this while loop...
            while(hasAppeared)
            {
                // Check if the combo is not still on the screen...
                if(FirstComboOf(combo, 0) == -1)
                {
                    hasAppeared = false;
                }
                Waitframe();
            }
            Waitframe();
        }//!End while(true)
    }//!End void run()
}//!End ffc script comboString


#3 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 07 March 2012 - 04:38 PM

heres mine its simpler. You just type the combo where the 65 is or i could put a d function.

CODE
import "std.zh"
int a = 0;
int message = 0;
int done = 0;

ffc script new_script
{
    void run()
    {
    done = 0;
    message =0;
    while(true)
       {
           for(a = 0; a < 175; a++)
           {
              if (Screen->ComboD[a]==65) message = 1;            
           }
       if (message == 1 && done == 0) Screen->Message(1);
       if (message == 1) done =1;
       Waitframe();
       }

    }
}

Edited by tox_von, 07 March 2012 - 04:59 PM.


#4 lucas92

lucas92

    Defender

  • Members

Posted 07 March 2012 - 04:49 PM

tox_von, learn how to indent for readability... And I'm not even sure that your script would work.



#5 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 07 March 2012 - 04:57 PM

http://www.mediafire...8iux1ppwwksbydy

mine works

#6 Kite

Kite

    ???

  • Members

Posted 07 March 2012 - 05:00 PM

I wrote this before lucas92 replied and tox_von edited his post and made another one. icon_shrug.gif

That would be great tox_von, except what you offered sacrifices ease of setup and makes it impossible to use it in more than one situation without literally making another script with copy/paste. At the very least, offer the ability to set things up inside of void run() if you are going to suggest it for people to use. Hell, you didn't even note half of the things you have to edit in that script to make it work (and it's not limited to int message at the top or that combo number you noted).

I'm not saying that what I made is perfect. It may not even be what Cukeman wanted. But you have to remember the people that are using the script when you suggest "simpler" versions. This is especially important in the request forum. Yeah, your version uses less lines of code and doesn't have comments sprinkled all over it (I religiously comment almost everything I code/script/whatever, even if the comments are useless to most people). I'll give you that. I'd even welcome optimizations to what I made... so long as ease of use is not sacrificed as you did.

Sorry for that little mini-rant, but simplicity is not always the best option when it sacrifices usability.

Edit: Actually, I was wrong about the int message. That isn't supposed to be edited at all. Which makes that whole script even more confusing. Use some Dx values. icon_frown.gif

#7 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 07 March 2012 - 05:36 PM

is this what you mean? im still learning how to code thats why im answering questions to see if i can get the answer. and thats why i put my answer because i spent 20 mins trying to get it and it didnt matter if there were two options my code would have only been wasted anyway.

CODE
import "std.zh"
int a = 0;
int message = 0;
int done = 0;

ffc script new_script
{
    void run(int d0,int d1)
    {
    done = 0;
    message =0;
    while(true)
       {
           for(a = 0; a < 175; a++)
           {
              if (Screen->ComboD[a]==d0) message = 1;            
           }
       if (message == 1 && done == 0) Screen->Message(d1);
       if (message == 1) done =1;
       Waitframe();
       }

    }
}

Edited by tox_von, 07 March 2012 - 05:39 PM.


#8 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 07 March 2012 - 09:18 PM

I tried out the first script (Nick's) and it worked great. Thanks a million! icon_smile.gif


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users