Ok... scripting problems

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Ok... scripting problems

Postby chickens1127 » Fri Apr 17, 2009 10:14 pm

I'm SO stupid with coding, so bear with me.

I am playing around with building a simulator.

1. Real stupid: To make monet I create a variable and name it money, correct?
2. How the game will work (maybe) is you have a ship and you sim month to month. Each month, a pop-up comes up telling you how many prizes (merchant ships) you have taken and how much there worth. I need some type of code that each month it runs a script that roles like a computerized dice (user dosen't see it- computer calculates it), so that 0 or 1 means you get 0 prizes, 2,3,4 you get 1, and 5 and 6 for 2 prizes. I would also like a way (if possible) that it repeats it multiple times for the amount of ships you own, given you make a variable called ship to remember that.

... more to come
Hi... It's Chickens1127...
CHINCHILLAS ROCK!

RIP Crazygamemaker
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby Mystery » Fri Apr 17, 2009 11:07 pm

Yes, to increase and decrease your money, you need to create a variable, and name it for example money :)

roles like a computerized dice

0 or 1 means you get 0 prizes, 2,3,4 you get 1, and 5 and 6 for 2 prizes.


Ummm Chickens, does this computerized die have 7 sides (one with 0 on it additionally)? :shock:
If you want a die with 6 sides, you might want to re-consider when the player gets what :)

For a 6-sided die and money (you need to create the variables roll and money):
Code: Select all
randomize
roll=Int(Rnd * 6) + 1
if roll=1 Then money=money
if roll>=2 and roll<=4 Then money=money+1
if roll>=5 Then money=money+2
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Mon Apr 20, 2009 11:19 am

Chickens, if you read my articles on BbB, you will find ways to solve problems like these. Now, let me fix mystery's code:
create a variable named ships and store there the number of the ships of the player
Code: Select all
For i=1 to ships
randomize
roll=Int(Rnd * 6) + 1
loot=0
if roll>=2 AND roll<=4 Then loot=1
if roll>=5 Then loot=2
money=money+loot
next


That added the loop for each ship and made the code more compact
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby chickens1127 » Mon Apr 20, 2009 12:33 pm

Great! But...





3. Then, I need a code very similar to the rolling thingy, which is a 6 sided dice that roles and if you roll a 1 or a 2 a ship is minused (it was captured) but every other number is safe. This code also gets repeated for all the ships you have. This would be the same as before, but would you need to make a new roll variable?
Hi... It's Chickens1127...
CHINCHILLAS ROCK!

RIP Crazygamemaker
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby Lyberodoggy » Mon Apr 20, 2009 6:42 pm

no, use the same code and change the parts you need
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Mon Apr 20, 2009 7:51 pm

Hehe, thanks Doggy :)
I never pretended to be good with scripting :P
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Tue Apr 21, 2009 8:15 pm

Everyone's good. As long as the script works it's good. Just when you create scripts for others, it's also good to make them more readable to human eye, so that the reciever will learn from it ;)
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Tue Apr 21, 2009 9:54 pm

Lol, my scripts work, but must look awful :lol:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests