Author Topic: [Help Needed] Scripting in dig deep  (Read 6555 times)

0 Members and 1 Guest are viewing this topic.

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
[Help Needed] Re: Scripting in dig deep
« Reply #30 on: January 13, 2016, 07:26:33 PM »
Use the script command to call other scripts from your main PlayerJoin script.
Is there a limit to how many Script commands the game can load up during a player join? I have many at this point, and they don't all load. Or some certain order of execution. Especially with seteventitemswing.
Focus determines reality...

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Scripting in dig deep
« Reply #31 on: January 13, 2016, 09:22:35 PM »
Is there a limit to how many Script commands the game can load up during a player join? I have many at this point, and they don't all load. Or some certain order of execution. Especially with seteventitemswing.
There is no limit. If they don't all load then one of us has made a mistake somewhere.

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #32 on: January 13, 2016, 10:47:21 PM »
There is no limit. If they don't all load then one of us has made a mistake somewhere.
Good to know. Probably my mistake somewhere. The scripting is very complex, and even thoughI have had much success, I still have much to understand.
Focus determines reality...

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #33 on: January 16, 2016, 10:18:09 AM »
I may know where I am going wrong, but don't know how to figure it out. On 3 of my item swing scripts, they're are script 'trees'. So I have all related scripts set to run on player join. I believe this may be causing them to not function. If I run them all manually, they work perfectly. The trial and error is tedious, and I know I'm close. Here's 1.

5 script item swing;

Script 1 magicmushroom

If
Is Equipped [Red Mushroom] [true]
Then
SetEventScript [Itemswing] [Red Mushroom] [magicmushroom\manabuff]
End If

Script 2 manabuff

Script [magicmushroom\manaboost]
Script [magicmushroom\rminv]
Script [magicmushroom\mbcancel]

Script 3 manaboost

If
HasHistory [mana] [player] [true]
Then
History [mana] [player] [100]
Loop
End If

Script 4 rminv

If
HasInventory [player] [Red Mushroom] [true]
Then
Inventory [player] [394,3008,288] [Red Mushroom] [1]
End If

Script 5 mbcancel

Wait [30000]
Script [magicmushroom\manaboost] [cancel]

And that's it. Like I said, this works, but I don't know what parts needed to be on the player join or not to make it auto-work. Otherwise I have to run the script for everyone that joins.
« Last Edit: January 17, 2016, 09:15:37 AM by Rev Elevenclaw »
Focus determines reality...

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Scripting in dig deep
« Reply #34 on: January 16, 2016, 03:37:38 PM »
but I don't know what parts needed to be on the player join or not to make it auto-work. Otherwise I have to run the script for everyone that joins.
You don't need script 1 at all, just put this command into the PlayerJoin script:

SetEventScript [Itemswing] [Red Mushroom] [magicmushroom\manabuff]

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #35 on: January 16, 2016, 10:36:11 PM »
You don't need script 1 at all, just put this command into the PlayerJoin script:

SetEventScript [Itemswing] [Red Mushroom] [magicmushroom\manabuff]

Thanx. I'll do that.
Focus determines reality...

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #36 on: January 23, 2016, 12:09:39 AM »
Scripting for DD is going well for me. My map now has mana, hunger, thirst and sanity player status effects. All but sanity are perfectly functioning. Also many items are now 'enchanted'. I am going to start a 'your world' thread soon, to better share the content of 'Castlevania', and keep this 1 open for DD script questions.
Focus determines reality...

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #37 on: January 25, 2016, 12:46:10 AM »
Ok I think I have finally bitten off more than I can chew. My sanity scripts are working, that is to say the amount you have and it's up/down ability. However getting the effects to work properly is a whole other matter. The following script is the culmination of my attempts.


sanity\insanityfx

If
   HasHistory [sanity] [player] [>=] [76]
Then
   Script [sanity\75chance] [cancel]
   Script [sanity\50chance] [cancel]
   Script [sfx\viewaskewundo]
   Script [sanity\0chance] [cancel]
Else if
   HasHistory [sanity] [player] [<=] [75]
   Script [sanity\50chance] [cancel]
Then
   Script [sanity\75 chance]
   Loop [60000]
Else if
   HasHistory [sanity] [player] [<=] [50]
   Script [sfx\viewaskewundo]
Then
   Script [sanity\50chance]
   Loop [60000]
Else if
   HasHistory [sanity] [player] [<=] [25]
   Script [sanity\0chance]
Then
   Script [sanity\25chance]
   Loop [60000]
Elseif
   HasHistory [sanity] [player] [=] [0]
Then
   Script [sanity\0chance]
   Loop [30000]
End if
   Loop [1000]

So this is complex to me because sanity goes back n forth, not just ticking down then refill completely like my hunger script.

And if this takes 1;

If
   HasInventory [player] [Cooked Duck Meat] [true]
Then
   Inventory [player] [x,x,x] [move] [Cooked Duck Meat] [1]
End If

Then why does this take 2?

If
   HasInventory [player] [Bottle Of Water] [true]
Then
   Inventory [player] [x,x,x] [move] [Bottle Of Water] [1]
End If
« Last Edit: January 25, 2016, 02:32:39 AM by Craig »
Focus determines reality...

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #38 on: January 25, 2016, 01:14:10 AM »
Well that's annoying...
Focus determines reality...

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Scripting in dig deep
« Reply #39 on: January 25, 2016, 02:33:06 AM »
Well that's annoying...
I put NoBBC tags around the script

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Scripting in dig deep
« Reply #40 on: January 25, 2016, 02:41:47 AM »
If
   HasHistory [sanity] [player] [>=] [76]
Then
   Script [sanity\75chance] [cancel]
   Script [sanity\50chance] [cancel]
   Script [sfx\viewaskewundo]
   Script [sanity\0chance] [cancel]
Else if
   HasHistory [sanity] [player] [<=] [75]
   Script [sanity\50chance] [cancel]
Then
   Script [sanity\75 chance]
   Loop [60000]
Else if
   HasHistory [sanity] [player] [<=] [50]
   Script [sfx\viewaskewundo]
Then
   Script [sanity\50chance]
   Loop [60000]
Else if
   HasHistory [sanity] [player] [<=] [25]
   Script [sanity\0chance]
Then
   Script [sanity\25chance]
   Loop [60000]
Elseif
   HasHistory [sanity] [player] [=]

Then
   Script [sanity\0chance]
   Loop [30000]
End if
   Loop [1000]

I don't know if the errors above are just typos in your post or actual errors in your real script on xbox.

The HasHistory check on line 9 (highlighted in red) is redundant because the script can only get to line 9 if the HasHistory check on line 2 fails, i.e. if sanity <= 75
The script commands you have in the conditional blocks (highlighted in yellow) might be throwing the remaining script execution off.

Because there are no other conditionals in the if block starting at line 8, apart from the redundant HasHistory check, it is effectively an else block, so the following then block (starting at line 11) will always be executed if line 2 fails (sanity <= 75), meaning the remaining Elseif/Then blocks can never be executed.
« Last Edit: January 25, 2016, 02:45:24 AM by Craig »

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #41 on: January 25, 2016, 03:07:33 AM »
I don't know if the errors above are just typos in your post or actual errors in your real script on xbox.

The HasHistory check on line 9 (highlighted in red) is redundant because the script can only get to line 9 if the HasHistory check on line 2 fails, i.e. if sanity <= 75
The script commands you have in the conditional blocks (highlighted in yellow) might be throwing the remaining script execution off.

Because there are no other conditionals in the if block starting at line 8, apart from the redundant HasHistory check, it is effectively an else block, so the following then block (starting at line 11) will always be executed if line 2 fails (sanity <= 75), meaning the remaining Elseif/Then blocks can never be executed.

They are errors. I have been moving things around in the script, experimenting to make it work. I will try to put them in proper spots again. As far as line 9 is concerned... Good point there. I have removed it.
Focus determines reality...

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #42 on: January 25, 2016, 06:23:30 AM »
I decided to 'break it down' a bit to accomplish concept. So I wrote a simple script, it works. However, the script it activates has a IsRandom in it and I believe randomization  isn't working. If I run it manually the 'then' runs, but on active mode in game it runs one or the other only. Here's the concept script;

Script 1 always runs, sanity\75sanity

If
   HasHistory [sanity] [player] [<=] [75]
Then
   Script [sanity\75chance]
   Wait [10000]
Else
   Script [sanity\75chance] [cancel]
End If
Loop [1000]

Script 2 activated by script 1, sanity\75chance

If
   IsRandom [1,2]
Then
   Script [put your own script here]
Else
   Notify [blah blah] [global] [0,0,0]

Need verification. Don't forget this is for DD.



« Last Edit: January 25, 2016, 06:56:52 AM by Rev Elevenclaw »
Focus determines reality...

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Scripting in dig deep
« Reply #43 on: January 25, 2016, 06:52:57 AM »
I decided to 'break it down' a bit to accomplish concept. So I wrote a simple script, it works. However, the script it activates has a IsRandom in it and I believe randomization  isn't working. If I run it manually the 'then' runs, but on active mode in game it runs the 'else'. Here's the concept script;

Script 1 always runs, sanity\75sanity

If
   HasHistory [sanity] [player] [<=] [75]
Then
   Script [sanity\75chance]
   Wait [10000]
Else
   Script [sanity\75chance] [cancel]
End If
Loop [1000]

Script 2 activated by script 1, sanity\75chance

If
   IsRandom [1,2]
Then
   Script [put your own script here]
Else
   Notify [blah blah] [global] [0,0,0]

Need verification. Don't forget this is for DD.
Maybe it'd be better if your describe in words what you're trying to do with sanity.

I'm 100% positive the IsRandom command works correctly.
The line in red doesn't do anything because sanity\75chance is not a looping script.
What does the script in yellow do?

Rev Elevenclaw

  • Sr. Member
  • ****
  • Posts: 372
  • Awards 2 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Rev Elevenclaw
Re: Scripting in dig deep
« Reply #44 on: January 25, 2016, 07:14:29 AM »
This is hard to explain for me. My sanity script works like a slide bar where it can go up and down based on what you do\encounter. So far, 3 things bring it down and there are 3 ways to bring it up. At 75, 50, 25, and 0 a script activates for chances to experience 'insanity effects'.


I'm 100% positive the IsRandom command works correctly.
The line in red doesn't do anything because sanity\75chance is not a looping script.
What does the script in yellow do?

Ok, you would know, I trust in that:) I will remove the red line. The yellow activates a simple cctv script that runs for 300 ms.
« Last Edit: January 25, 2016, 07:17:26 AM by Rev Elevenclaw »
Focus determines reality...