Custom Map #728: Extermination. By: Decagon

Started by AutoPost, April 09, 2017, 11:57:46 AM

Previous topic - Next topic

tornado

Got a very simple test model. it...doesn't work. the syntax isn't Wrong, it will compile, just not do anything when you run it.


# --HQDeathFail-- 5/20/2017 9:17:24 PM

do(0 1)
if GetShipFromSlot 23 eq -1
  FAILMISSION
endif
loop

Getshipfromslot returns -1 if the ship is not built.
the rest is obvious. can't think why it doesn't work, or why there are two separate commands that both do this.
Since I don't understand the issue, can someone fix this and explain where I went wrong(What more proof do
I need that I should go learn stack based languages).

Also, correct me if I'm wrong, but isn't the idea to prevent HQ bombing? a confinement script would only work if it was
fed the whole map, and handles ships being destroyed and resummoned, snd even then that doesnt solve the issue.
Now CEO of Particular Endeavors. http://knucklecracker.com/forums/index.php?topic=23752.new#new
We apologize for all inconveniences that we caused.
Quotefirst, you have to imagine a very big box, fitting inside a very samll box.
then, you have to build one

FOXX

With the confinement you can cover the whole map and leave a banner where the big ship is. [This worked with my Maze Series] If its a moving big ship that is impossible with this script.
It can be a base for a future script but i don't know how to make this. [i am learning myself]
To make this a fail mission when somebody tries to go out of the confinement area is also an option.
The FPAF
For My Maps and Ships!
Including  CUSTOM MODULE MAPS & SHIPS

Stickman

Quote from: tornado on May 20, 2017, 04:51:04 PM
Got a very simple test model. it...doesn't work. the syntax isn't Wrong, it will compile, just not do anything when you run it.


# --HQDeathFail-- 5/20/2017 9:17:24 PM

do(0 1)
if GetShipFromSlot 23 eq -1
  FAILMISSION
endif
loop

Getshipfromslot returns -1 if the ship is not built.
the rest is obvious. can't think why it doesn't work, or why there are two separate commands that both do this.
Since I don't understand the issue, can someone fix this and explain where I went wrong(What more proof do
I need that I should go learn stack based languages).

Also, correct me if I'm wrong, but isn't the idea to prevent HQ bombing? a confinement script would only work if it was
fed the whole map, and handles ships being destroyed and resummoned, snd even then that doesnt solve the issue.

Proper code (syntaxwise) should look something like this:

23 GetShipFromSlot -1 eq if
    failmission
endif

You don't need a loop here and while your code may compile, it doesn't mean it would work, sorry. In your case you have "do" arguments mixed up - you need to put bigger number first, smaller second - so your script doesn't even get inside "do-loop".

But since you can't block player from changing ship slot, it's better to check for ship name. Give your ship unique name and check for it. Like:

$ShipName:"LATHE"
$FailConv:"Lathe lost"

23 0 do
    I getshipfromslot 0 lt I getshipnamefromslot <-ShipName eq and if
        <-FailConv showconversation #It's nice to tell player why mission was failed in short conversation to prevent confusion
        failmission
    endif
loop
=====> This is a moderately pointy stick. You need to poke me with it once in three days if you need PRPL from me

Dark Ambition

Quote from: Stickman on May 20, 2017, 07:30:16 PM
Quote from: tornado on May 20, 2017, 04:51:04 PM
Got a very simple test model. it...doesn't work. the syntax isn't Wrong, it will compile, just not do anything when you run it.


# --HQDeathFail-- 5/20/2017 9:17:24 PM

do(0 1)
if GetShipFromSlot 23 eq -1
  FAILMISSION
endif
loop

Getshipfromslot returns -1 if the ship is not built.
the rest is obvious. can't think why it doesn't work, or why there are two separate commands that both do this.
Since I don't understand the issue, can someone fix this and explain where I went wrong(What more proof do
I need that I should go learn stack based languages).

Also, correct me if I'm wrong, but isn't the idea to prevent HQ bombing? a confinement script would only work if it was
fed the whole map, and handles ships being destroyed and resummoned, snd even then that doesnt solve the issue.

Proper code (syntaxwise) should look something like this:

23 GetShipFromSlot -1 eq if
    failmission
endif

You don't need a loop here and while your code may compile, it doesn't mean it would work, sorry. In your case you have "do" arguments mixed up - you need to put bigger number first, smaller second - so your script doesn't even get inside "do-loop".

But since you can't block player from changing ship slot, it's better to check for ship name. Give your ship unique name and check for it. Like:

$ShipName:"LATHE"
$FailConv:"Lathe lost"

23 0 do
    I getshipfromslot 0 lt I getshipnamefromslot <-ShipName eq and if
        <-FailConv showconversation #It's nice to tell player why mission was failed in short conversation to prevent confusion
        failmission
    endif
loop


Wait, so this fails a mission if the designated ship was destroyed and gives a conversation too? I've actually been trying to make that (and not knowing what the heck I was doing, so I didnt get anywhere), can I use it?

Can it also be converted to winning the mission if the designated player ship was destroyed?

Stickman

Quote from: Dark Ambition on May 20, 2017, 07:59:41 PM
Wait, so this fails a mission if the designated ship was destroyed and gives a conversation too? I've actually been trying to make that (and not knowing what the heck I was doing, so I didnt get anywhere), can I use it?
Yes, it does for designated player ship in slots.
I think you can use it no problem, the thing is 8 lines long and pretty generic, I doubt you'll run into copyright issues.

Quote
Can it also be converted to winning the mission if the designated player ship was destroyed?
Change "failmission" to "winmisson", but I see no point in doing this other than for "Easter Egg Secret Ending" stuff, because player can select designated ship and press "destroy" button anytime. And the win/fail part will activate as soon as you have unbuilt ship in slots, so if you plan to give the player some weird winning condition, like "pick up a ship from guarded area and the suicide it into enemy boss entity", you'll need something more complex than this one.
=====> This is a moderately pointy stick. You need to poke me with it once in three days if you need PRPL from me

tornado

thanks for the correction, I'm still getting the hang of this.
the reason I have a do loop where I is greater than Limit(And hey, if that wasn't allowed wouldn't it throw some kind of error. EG: limit = 1.1*10^9 stacks deep. other languages I am more comfortable with tend to) is because I wanted this to run that check indefinitely(and there's no 'forever loop' in PRPL that I could find, and yes I look at While, it's poorly documented).
I did bring up the whole "moving ship slot thing" as an issue, thanks for fixing that. I also brought up the 'Compiles but won't run' issue and put it down to "I don't know what I'm doing". thanks for this.

BTW: I'm not the first to ask(7 bill people alive, someone has) but can we please have someone look at the wiki? I don't understand stack based syntax and being told "Go look at CRPL" doesn't really help. also, the PF examine map resources button doesn't work.

Finally, we really needed a top for this. Drat.
Either I need to start relying on other people to bring up subjects like this and move them quickly, or something else needs to happen that I can't think of.
Now CEO of Particular Endeavors. http://knucklecracker.com/forums/index.php?topic=23752.new#new
We apologize for all inconveniences that we caused.
Quotefirst, you have to imagine a very big box, fitting inside a very samll box.
then, you have to build one

Stickman

Quote from: tornado on May 21, 2017, 05:29:53 AM
because I wanted this to run that check indefinitely
Everything in the script runs once per frame(30 frames per second), so you have your infinite loop "built-in"

Quote
BTW: I'm not the first to ask(7 bill people alive, someone has) but can we please have someone look at the wiki? I don't understand stack based syntax and being told "Go look at CRPL" doesn't really help. also, the PF examine map resources button doesn't work.

Finally, we really needed a top for this. Drat.
Either I need to start relying on other people to bring up subjects like this and move them quickly, or something else needs to happen that I can't think of.
To be honest, I think wiki is fine once you get some concepts(like the whole stack-based reverse nature) into your head properly. But we need some good comprehensive tutorial for that, preferably as a youtube video, and that's a pretty big task, unfortunately.
=====> This is a moderately pointy stick. You need to poke me with it once in three days if you need PRPL from me

tornado

No I mean things such a 'While' and 'loop' not being copy-pastes of each other, and some of the more interesting commands being given clear inputs and outputs('GETSHIPISDESTROYED' has no listings, so it is unclear as to what it needs be it name, slot, or UID0.
Now CEO of Particular Endeavors. http://knucklecracker.com/forums/index.php?topic=23752.new#new
We apologize for all inconveniences that we caused.
Quotefirst, you have to imagine a very big box, fitting inside a very samll box.
then, you have to build one

GoodMorning

#23
Now that I can get to the forum again...

Failing the mission upon HQ death is the current state of affairs. I had in mind something more like the following:

once
0 ->HQAge
0 ->NewHQ
0 ->InitialPlacement #Set to 1 if you are placing a HQ for the player.
endonce

<-InitialPlacement not if #You can place the HQ freely the first time - I can't see a good way to get around this that isn't vulnerable to processing order.
IsHQPresent if
1 ->InitialPlacement
else
return
endif
endif

IsHQPresent if #I'm unsure how this will react to enemy HQs.
<-NewHQ if
0 ->HQAge
0 ->NewHQ
endif

<-HQAge 1 add ->HQAge
else
<-HQAge 3 lt if #It's unlikely that the HQ was killed "naturally" inside a tenth of a second. Call it a momentary recharge for the Rift Engines.
FailMission
endif
1 ->NewHQ #This flag indicates that the HQ needs the counter reset next time it is detected.
endif


I don't know if the HQ will be detected if immediately destroyed. This may render the above useless.

I'm conversing with Stickman via PM to come up with a better solution.


Regarding the wiki, it's a shambles for PRPL documentation. However, the CRPL tutorial is the best introduction to stack-based scripting I've seen, and ports directly to PRPL.
A narrative is a lightly-marked path to another reality.