Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

[Answered] Variable Addition with Scripting

16 years ago
Okay... I have reread ALL of the articles; again. I have poured through every thread in this sub-forum... I'm sure there is a way to ADD variables together to display a total, but I dont know how it should be "worded".(script syntax) Say I have two variables, FOOD and AMMO, and want to add them together for a LOAD stat.... is it:
%LOAD := %FOOD + %AMMO
I mean..... does it need spaces in there or what. Is this even close? Also, if I do this on the global scripting page, and the clicked DEST page has a variable change, will LOAD reflect that change?
Just wondering how this can be done.

[Answered] Variable Addition with Scripting

16 years ago
at this point, solostrike and tsmpaul are the best scriptors on the site. eventaully one of them will notice this and get an answer to you.      
nate

[Answered] Variable Addition with Scripting

16 years ago
Well, let me throw a few more out here before they show......
Does any of this make sense? Would I put these "rules" in the global script?

# Hunger rule
IF %FOOD < 0 THEN
%WOUNDS :=  %WOUNDS +1
AND
%FOOD := 0 
#(do I leave out the ":" after FOOD???)

# Death rule
IF %WOUNDS >= 5 THEN $DEST = @P86

btw, thanks in advance for any help.

[Answered] Variable Addition with Scripting

16 years ago

spaces are needed to seperate variables, arguments etc.

you dont need the AND

 

# Hunger rule
IF %FOOD < 0 THEN
%WOUNDS :=  %WOUNDS +1
%FOOD := 0 

the death rule is good, except you need a : before @P86:

IF %WOUNDS >= 5 THEN $DEST := @P86

The : thing means you are ASSIGNING a value,

:= means assigning
= means you are evaluating something (i.e. if then statement)

[Answered] Variable Addition with Scripting

16 years ago
btw sorry for the choppy response, im in the middle of something and i just happened to see this, i hope i helped, feel free to ask questions...

[Answered] Variable Addition with Scripting

16 years ago
Cool, thanks Solo. I know how picky computers can be with spelling- every mark and space must be just right. Stupid machines. Or maybe, they're just acting stupid and biding their time.... I've seen 2001:ASO and Terminator, ya know.

I have another Q if you guys dont mind. Is there any way to put HTML forms into a game? For instance, I would like players to assign values for their beginning stats (distribute 9 points among three Abilities, for example)- any way to use select forms for this?

Just trying to get an idea of what I can do before starting my next game. I'll implement it with whatever capabilities are available (like links to pre-generated characters if the above isn't possible.)  btw, I dont know much about this stuff. I've been reading a bunch of HTML and CGI/php/sql tutorials, so I'm picking it up (slowly), but it's still over my head, mostly.

[Answered] Variable Addition with Scripting

16 years ago

Well what you could do is have a page that your "Assing 1 point to ____ attribute" links to that same page, but everytime its clicked, it adds 1 point ot the specific attribute, and then when the player is out of distributable points, you can have a link to proceed with the game.

Also, HTML shouldnt take you very long to learn, its just mark up language. What you should get into is CSS for your layouts/appearance and AJAX for functionality if you are lookign to build a website. AJAX is what all the new social networking sites are using, and Gmail is written in that as well. AJAX is a combination of java and some other language i cant remember, and it basically allows data requests to occur on the page without having to refresh or load a new page...

Research what is out there, there are so many different languages and all have their ups and downs, see what your comfortable in and also what is current.

[Answered] Variable Addition with Scripting

16 years ago
Cool, thanks again. I think I'm going to keep my first advanced game VERY simple, so I think I've got all I need for that.  For myself, I'm trying to figure out this CGI stuff with the .asp and .php scripting now. I cant figure out how to use form info from check-boxes......

if (param('var')) {// }

<?php $_POST>

<% Dim var var=Request.Form("var") %>

what the.....????
BOOM!!!    [Head explodes]

..................I'll check out some AJAX tutorials.
Thanks again.

[Answered] Variable Addition with Scripting

16 years ago

Ive forgotten pretty much all my programming/webauthoring languages, so Im sorry that i cannot help :(

[Answered] Variable Addition with Scripting

16 years ago
Forgotten?  I imagine that is easy to do with this stuff. lol  A lot of the languages (and there sure is a lot of 'em) share or borrow from each other, it seems. They should get some scientists working to figure this stuff out!!! ..... Seriously though, I think to learn this stuff I should be taking some classes- especially for whatever common language they use.(C++?) 

anyway...... about my next game........ I may have some Qs later about setting conditions for variable limits and/or link restrictions.  I'll tinker with it over the next few days to figure it out, but I am anticipating getting stumped.

btw: Thanks again for the help.

[Answered] Variable Addition with Scripting

16 years ago

All of the languages function in the same way, they just have different syntax (which is why they are called languages... like you say hi in english and hola in spanish, they are both greetings just said in different ways).

And if you were serious about this stuff i would suggest classes, in my high school there is a specific Computer Science course for grade 11 and then grade 12 gets into more advanced stuff.

The main stream programming languages are C++ and VB, they are both equally good and bad, its up to the individual to decide which to use because they are equally popular. As for web authoring languages, it seems that people are looking more towards the .net (which is what asp became) and ajax/java and it seems like its a good idea to know how to incorporate flash media into your webpages. Also CSS is a must for your layouts and visual appearnce as i said before.

Just a little tidbit of info, its very easy to hack into php code, its called sql injection. .net is what this site is based on and the only reason people stay away from this and use php is because php is open source and .net is microsoft based... The difference between php and asp/.net is that php loads your code before the page loads and the latter loads the code as requests are made (thus we can have "who is online" feature at the bottom or a "You have a new PM" message at the top without refreshing the page)

[Answered] Variable Addition with Scripting

16 years ago
awesome info. More Thanks. I was wondering what the best database -thingy was. I'll look into .asp some more.  Been reading some AJAX tutorials over the past few days (at w3schools and on the java.sun site.  "FacesServlet instance processes the DLabelPhaseListener instance that recognizes..." BOOM!!! head explodes. hehehehehe.)

I appreciate you pointing me in the right direction. It's hard to learn when you don't know what to learn....

[Answered] Variable Addition with Scripting

16 years ago
yes it can be very confusing! there is just too many options and no real standard... anyways, SQL is widely popular, and i do not know of any other database types, freesql.org allows you to practice with a free database, i suggest you sign up there and play around with the query language as well as learn how to link it to your web language.