Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Page script control - Best way to do it

4 days ago

So in the game I'm working on almost every page has a page script that runs as you move from page to page.  Part of many of these page scripts is something analagous to %COMBAT:=%COMBAT+2.  I am also using a single Item that acts as access to the Inventory Management set of pages. Clicking Use on this item does the classic %LASTPAGE:=$PAGEID, and there is one link out of the Inventory Management set of pages that executes the other half: $DEST := "@P" + %LASTPAGE.  

My problem is that if someone is on the page that does the Combat adjustment and then they go into Inventory Management, when they come back out, the page script runs again and doubles the stat adjustment.  

The only way I've thought of to prevent this would be to add a check variable (%FROMIM) that I set as true on the Item use link. Then I can check in on the page script and avoid having the page script do it's thing, but is there an easier way to prevent the page script from executing on a transfer like this? 

 

Page script control - Best way to do it

4 days ago

Not that I ever found. The way I got around this for crag was preventing people from accessing their inventory during combat.

The FROMIM thing you suggest will work, it'll just be a major pain to code.

If there's any way for you to move the page effects into the prior link script instead, that will also solve your problem. May not be feasible though.

Page script control - Best way to do it

4 days ago

Multiple pages link to this page, and the page script does a lot, so I really rather save having to replicate that on every link.  That's how I had things setup originally, which is why I didn't find it as a problem until now. Thanks for the suggestion, though.  

.

 

Page script control - Best way to do it

3 days ago
Is there another way to plan? In other words, can you count using some other method or variable?

You could add lots of code to check if someone has already been on that page, but that would only work if you want the variable to increment the first time someone hits that page and it won't work if navigation allows them to reach that page more than once and you want to count each time.

Does it matter? If you're counting, could you simply tell the player that if they do inventory management that will also count (against them)?

As a weird, alternate work-around, depending on how things work, could to decrease the counter when the player gets to inventory management so that it won't matter when the increment happens again?

Page script control - Best way to do it

3 days ago

Doing the %FROMIM variable that I suggested is basically doing that.  It just requires that I include a IF %FROMIM = 1 THEN %FROMIM=0 ELSE BEGIN {Whatever the page does} END on each page that does, or has a chance to cause an additive adjustment.  Tracking if each page has been visited, particularly since a given page can be visited multiple times, would be more code intensive that what I'm already doing there.  I'm also not sure how you would do this in an incremental fashion without those variables suffering from the same inflation, assuming you were counting visits and not just vist1 :=1 or := 0.

For it to count against them, I would need someway of automatically knowing that it had happened.  The dumbness of the script is the crux of the issue.  I plan to already include a notice at the beginning about not using the Go Back option, even if I CSS out the button as I intend.

The alternate work-around would work, but I would have to do more tracking variables to know what the appropriate bonus is to which stat for that kind of adjustment.  If I had less things that could tweak this might actually be easier than the solution I am currently working with.

 

Page script control - Best way to do it

3 days ago
Keep in mind a couple things here:

1. If you tell someone not to do it, they're going to do it.
2. You can't catch everything, especially in this environment. Just catch the obvious stuff and move on. If people find an exploit, who cares, just move on!

The trick on the FROMIN is, I guess you're going to have to set FROMIN on every page where it's "legal" to get the increment and reset FROMIN on the inventory pages? Hopefully you can catch every setting of that (which yes, does seem like quite a huge amount of work for this small adjustment -- which is why perhaps there's a different way to catch these things). If you're going to that level, why not set the increment on the page link, then you don't even need to use any code!

Page script control - Best way to do it

3 days ago

I will need to look closer at the actions for each page that I need to do to see what could be moved to links. One of the biggest blocks of code can definitely be moved to Global Page.  Fortunately, I only have about half a dozen pages to change at this stage.

My thought had been to put in on the page since any given page could be linked to by 12-20something other pages (think like monopoly board movement at the minimum), so that way I only have to set up (or fix) a given page effect once, instead of on every link to it.

Do Link variable changes take place before or after the link script?

 

Page script control - Best way to do it

3 days ago
I can't remember offhand, but I would think they would have to take place before since that's actually on the page before the destination