The Dink Network

scope

June 26th 2003, 07:02 PM
farmer.gif
let's say you ran a script, we'll call it box.c, and somewhere in that script, you called external() to another script, we'll call it dog.c. would the local variables from dog.c now apply to box.c as well (you could do something with the variables in dog.c from box.c)? and if not, how do i get them to without using global variables?
June 26th 2003, 08:31 PM
wizardg.gif
Paul
Peasant He/Him United States
 
What's all this "how do it do X without using Y" stuff lately? What's wrong with global variables?

Anyway, could you explain what you're trying to do a little more?

June 26th 2003, 08:53 PM
farmer.gif
sorry i didn't give a whole lot of detail, but it's really hard to explain it in detail...since there's a global variable limit of about a hundred or so, i'm trying to make the best use of locals as i can because in my project i'm seriously coming close to the limit and i'm not even halfway through...let's say in dog.c (from above example) there's a variable called &dog, and i want to increase that variable by one in box.c...would &dog be accessible through box.c even if the local exists in dog.c if i called external("dog","nameofproc")?
June 26th 2003, 11:43 PM
wizardb.gif
Phoenix
Peasant He/Him Norway
Back from the ashes 
I haven't tested (something you could've done before asking... ) but I think I can safely say "no, that won't work".
June 27th 2003, 02:59 AM
farmer.gif
yeah, i tested it, but since it didn't work i figured that i'd see if it was even possible but anyways thanks
June 27th 2003, 05:10 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Actually, the global limit is somewhere around the 250. I'm sure you won't be going over tyhat limit any time soon unless you're making the biggest epic of all time or a completely new battle system of some sort.

Just use globals, dont dawdle to much over such little things or you may lose interest and not finish your d-mod, which is such a common sight these days.
June 27th 2003, 05:56 AM
farmer.gif
whoa, cool...it is a new battle system that i'm designing...no way i'm giving up on this one
June 27th 2003, 10:46 AM
old.gif
a new battle system, i would love to see that one

I think the global limit is ~256
June 27th 2003, 11:20 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
"The limit is 248 total globals LESS the number of slots you want to reserve for ALL local variables in ALL instances of ALL scripts that can be running at any given moment."

From the Greatest Document Of Recent Times, the DinkC Reference v3.1.

But one way around the limit (if you're just looking to pass variables from script-to-script on the same screen) is to heavily abuse editor_frame and editor_seq... though it could have some disastrous consequences if you don't set them back to their original values, which you'd need to store in variables... and hence the problem really isn't solved.
June 27th 2003, 11:23 AM
wizardg.gif
Paul
Peasant He/Him United States
 
Well, without knowing the situation better, I can't help much, but I would recomend setting aside one global (or maybe you've already got a temp global of some kind?) for passing values. I think you'll find it comes in handy often enough to make it worth while. The original game uses &save_x and save_y to pass the location where a creature died to the treasure creating scritp for example. In fact, you could probably use those variables unless they're getting used for something else at the same time.
June 27th 2003, 03:50 PM
farmer.gif
that's an idea i had in mind, have some variables that could be "recycled", and i'm working on understanding how to use supervars because it sounds like it would help a whole lot
June 27th 2003, 11:48 PM
anon.gif
uberpizza
Ghost They/Them
 
New battle system what a laugh LOL! Heh.... heh....heh....ok nvm lol
June 28th 2003, 03:48 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
What's so funny about a new battle system? I've been working on one for a long time and I would say it's about 50% complete. Writing algoritms for damage calculation, whose turn it is (its turn-based), etc... is very difficult, at least in Dink.
June 28th 2003, 06:38 AM
wizardb.gif
Phoenix
Peasant He/Him Norway
Back from the ashes 
Someone (or S) had it working in the last dmod he gave out. I think it's name was Red Shield or something. Red Shield Unfinished, probably. It's Final Fantasy inspired, and it works. But it's quite advanced, considering the scripting.