Jump to content

Photo

Next combo if combo on screen


  • Please log in to reply
70 replies to this topic

#31 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 12 March 2012 - 07:31 PM

Thats really complicated, I did not want to change it back if the trigger is not there anymore.
This is all it has to do: "//If trigger is ON and target is NOT changed, change it"

Although, this version of the script seems to be useful too. I'll save it somewhere on my computer, maybe I'll need it sometime icon_biggrin.gif

#32 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 12 March 2012 - 07:35 PM

So.... the first script was all you wanted there?

Then what did you mean by this:
QUOTE
I just want the bool triggerFound to turn false if the trigger disappears from the screen. Only the first script needs this.


#33 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 12 March 2012 - 08:07 PM

Well, if the trigger is on the screen but the target is not nothing should happen. But that was not the case. The problem is that, if the trigger appeares on the screen and then disappears through combo cycling, the target, wich appears after the trigger has disappeared changes to the next combo, even though the trigger was not there anymore.

If the trigger appears and disappears, without an target on the screen, then the script should "forget" that the trigger was there.

Sorry, I have a hard time trying to explain this, I'm not a native english speaker.
Hope it's all clear now ;D

#34 tox_von

tox_von

    Zelda Addict

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

Posted 12 March 2012 - 09:00 PM

wouldnt it be easier to write the code something like this?

CODE
import "std.zh"

int is97 = 0;
int no96 = 1;

ffc script new_script
{
    void run()
    {
    is97 = 0;
    no96 = 1;
       while(true)
       {
          for(int i=0; i<175; i++)
            {
            if(Screen->ComboD[i]==97) is97 = 1;
            if (is97 == 1) if(Screen->ComboD[i]==99) Screen->ComboD[i]=100;
            if(Screen->ComboD[i]==96) no96 = 1;    
            if (no96 == 0) if(Screen->ComboD[i]==101) Screen->ComboD[i]=102
            if(Screen->ComboD[i]==107) Screen->ComboD[i]=27
            }
        Waitframe();
        }
    }
}

Edited by tox_von, 12 March 2012 - 11:14 PM.


#35 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 12 March 2012 - 10:23 PM

Tox_von: Easier =/= better. I already more flexible code written, and your code doesn't look like it fixes Avataro's problem.

Avataro: I recommend you change your setup so that instead of trying to make the script 'forget' the trigger that appeared briefly was there, you just keep it from appearing.

#36 tox_von

tox_von

    Zelda Addict

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

Posted 12 March 2012 - 10:39 PM

isnt this the question?

Hi, I am requesting an easy ffc script that does 3 different things:
1: it changes every combo99 on the screen to the next in the list if combo 97 is on screen. done
2: it changes every combo101 on the screen to the next in the list if there is no combo 96 on screen. done
3 (optional): if there are any combo107 on the screen, it always spawns combo27 at the same position as the combo107, but on layer 2. done
does it sound doable?

#37 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 13 March 2012 - 08:10 AM

QUOTE(MoscowModder @ Mar 13 2012, 06:23 AM) View Post

Tox_von: Easier =/= better. I already more flexible code written, and your code doesn't look like it fixes Avataro's problem.

Avataro: I recommend you change your setup so that instead of trying to make the script 'forget' the trigger that appeared briefly was there, you just keep it from appearing.


That won't be possible
At first I though it was going to be an easy script, I did not know it was going to be so complicated.. :-(
You should try out to understand what I'm trying to do in the test quest. Maybe there is another solution to do this.

A script like this would do it:
If trigger is NOT on screen AND target is NOT on screen, nothing happens.
If trigger IS on screen AND target is NOT on screen, nothing happens.
If trigger is NOT on screen AND target IS on screen, nothing happens.
If trigger IS on screen AND target IS on screen, change the target to the next combo in the list.

(I hope it's possible to have an "&" in an "if" line)

@Tox_von, is your script my first, second, or third request?

Edited by Avataro, 13 March 2012 - 08:52 AM.


#38 tox_von

tox_von

    Zelda Addict

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

Posted 13 March 2012 - 08:19 AM

What do you mean trigger like trip switches. My script was your original question all of them.I think link colision this does that or flags to step on. Which was i another topic. Doesnt the other code work already i was only writing mine for practice as im still learning scripting.


The functions you want can all be done but i still dont understand the question fully.
The triggers should be able to be done with counters.

I think my script answers you origional question eg
if 97 on screen change 99 to 100
if no 96 on screen 101 change to 102
and change 107 to 27

but i didnt know how to put it to layer 2 you can look at my script to see this.


if what your trying to do is step on switches like your example i think you need to use counters. eg if 5 are stepped on something happens.

Edited by tox_von, 13 March 2012 - 08:36 AM.


#39 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 13 March 2012 - 09:28 AM

So your script are all 3 together? I tried it out. You forgot some ";" in your script. They are missing at the end of these lines:
CODE
            if (no96 == 0) if(Screen->ComboD[i]==101) Screen->ComboD[i]=102
            if(Screen->ComboD[i]==107) Screen->ComboD[i]=27

Now your script does not work right though. The problem is that the "int is97" should turn back to 0 when combo97 disappears from the screen.
The "int no96" should always turn back to 1 if a combo96 appears on the screen again.
If combo99 changed to 100 it should never change back though. Same for combo101 and 102. That was the problem with MoscowModders last script.

EDIT: I can't believe it, but I fixed it myself!!!
CODE
ffc script changeCombosIfFound2Way{
    void run ( int triggercombo, int targetcombo ){
        bool triggerActive = false;
        bool combosChanged = false;
        while(true){
            for(int i=0; i<175; i++){
                //Check for the trigger combo
                if(Screen->ComboD[i]==triggercombo) triggerActive = true;
            }
                //If trigger is ON and target is NOT changed, change it
                if(triggerActive==true && combosChanged==false){
                    for(int i=0; i<175; i++)
                        if(Screen->ComboD[i]==targetcombo) Screen->ComboD[i]++;
                    combosChanged = true;
                }
                //If trigger is OFF and target IS changed, change it back
                if(triggerActive==false && combosChanged==true){
                    for(int i=0; i<175; i++)
                        if(Screen->ComboD[i]==targetcombo+1) Screen->ComboD[i]--; // I have removed this line, to solve the problem
                    combosChanged = false;
                }
            triggerActive = false;
            Waitframe();
        }
    }
}


Thank you so much for the help MoscowModder and Tox_von!
Now I would be really happy if you would do the same for the ChangeIfNotFound script.

Edited by Avataro, 13 March 2012 - 09:32 AM.


#40 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 March 2012 - 10:02 AM

Wait... how did you fix it? You just removed the part that changes it back?

But then wouldn't it be exactly like script #1?
QUOTE
A script like this would do it:
If trigger is NOT on screen AND target is NOT on screen, nothing happens.
If trigger IS on screen AND target is NOT on screen, nothing happens.
If trigger is NOT on screen AND target IS on screen, nothing happens.
If trigger IS on screen AND target IS on screen, change the target to the next combo in the list.

^^ That is exactly what script #1 does: if it finds the trigger, then it changes all instance of the target. If no trigger, no change. If no target, nothing to change.

So what exactly do you want with the ChangeIfNotFound script, then?

#41 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 13 March 2012 - 10:18 AM

QUOTE(MoscowModder @ Mar 13 2012, 06:02 PM) View Post

Wait... how did you fix it? You just removed the part that changes it back?

But then wouldn't it be exactly like script #1?

^^ That is exactly what script #1 does: if it finds the trigger, then it changes all instance of the target. If no trigger, no change. If no target, nothing to change.

So what exactly do you want with the ChangeIfNotFound script, then?


Actually it's not the same. I'm 100% sure. In your new script this "bool_triggerActive" turns false, when the trigger disappears. (but that doesn't mean, that I wanted the target combo to change back). If it turns true in your first script then it stays true all the time, even if the trigger disappears from the screen.

Edited by Avataro, 13 March 2012 - 10:31 AM.


#42 tox_von

tox_von

    Zelda Addict

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

Posted 13 March 2012 - 03:18 PM

i think you need break for the if is 97 changes when on the same screen. If variables change when the loops are going the program doesnt recognise it.

eg if(is97 == 0)break;

is97 = 0; or i think this puts it back to 0 if thats not what you mean.
not96 = 1; this puts not 96 to 1

i did'nt test my code i was just giving an example thats why there were errors and i still didnt understand what you were doing with the trip switches.

And i still dont know plotting to different layers which doesnt seem to be in the other script either.

Edited by tox_von, 13 March 2012 - 03:33 PM.


#43 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 March 2012 - 05:11 PM

QUOTE(Avataro @ Mar 13 2012, 10:18 AM) View Post

Actually it's not the same. I'm 100% sure. In your new script this "bool_triggerActive" turns false, when the trigger disappears. (but that doesn't mean, that I wanted the target combo to change back). If it turns true in your first script then it stays true all the time, even if the trigger disappears from the screen.


Why do you want the variable to change back when the trigger disappears if you don't want the target to change back with it? You do realize that all local variables are reset when you leave the screen, right?

#44 tox_von

tox_von

    Zelda Addict

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

Posted 13 March 2012 - 06:23 PM

If combo99 changed to 100 it should never change back though. Same for combo101 and 102. That was the problem with MoscowModders last script.

have you tried step=next permanent there are other step nexts in the list i think it automaticly resets like bushes i think you need another trigger like linkcollision

Also what are you trying to do with combo 97 you might not have stated all your trying to do.


Edited by tox_von, 14 March 2012 - 12:02 AM.


#45 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 14 March 2012 - 10:46 AM

QUOTE(tox_von)
have you tried step=next permanent there are other step nexts in the list i think it automaticly resets like bushes i think you need another trigger like linkcollision

No I'm okay with it resetting when reentering the screen. I meant that his script is resetting the combo without leaving the screen.

QUOTE(MoscowModder @ Mar 14 2012, 01:11 AM) View Post

Why do you want the variable to change back when the trigger disappears if you don't want the target to change back with it? You do realize that all local variables are reset when you leave the screen, right?

If the variable does not change back when the trigger disappears, then the target (wich appears after a trigger has disappeared) will change even though the trigger is not there anymore.

Haven't I said this already? If not, then sorry icon_smile.gif

Edited by Avataro, 14 March 2012 - 10:55 AM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users