ivanforum ivanforum
Forum for Iter Vehemens ad Necem
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   fchat fChat   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The IVAN script challenge
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    ivanforum Forum Index -> Programming
View previous topic :: View next topic  
Author Message
holybanana
Party Chairman


Joined: 04 Jan 2005
Posts: 155
Location: Above Valpurus

PostPosted: Tue Sep 05, 2006 8:55 am    Post subject: The IVAN script challenge Reply with quote

Comrades, I greet you in the name of IvanDev, the One True Socialist Game Development Party.

I present you a challenge.

Solve a series of script exercises of my script lectures, starting from lecture II, at

http://ivan.sourceforge.net/script

and you shall be my superior for one six hour coding day.
You may order me to code whatever you like in IVAN.

The challenge starts September 6th at 0:00 in my time zone (GMT+2) when I will post lecture V and its exercise(s).

The purpose of this challenge is to spark interest in IVAN scripting. The exact rules of the game:

I. A participant must post the answers to all exercises of lectures II-V in this topic.
II. I will not comment whether they are right or wrong until someone gets all correct.
III. When someone does this, I will reply "X is Marx.", where X is the winner. This is because only Marx can command the Party Chairman.
IV. If no one qualifies as Marx within four weeks, the game expires. I'm not going to wait years for your answers.
V. Marx composes a list of tasks which I try to complete. The list consists of at most ten entries.
VI. I will choose a day when I have six hours free time, or possibly two with three hours, if I'm busy.
VII. I only code. If the tasks require new graphics, I'm not going to draw them. I may order Juhani Kahvi to do this, but you know that in socialist systems things do not happen that simply. In reality, he may or may not complete the tasks in time, even though officially he naturally always does. If Marx himself or someone else can supply the graphics, there's no problem of course.
VIII. I choose the order which I complete the tasks in Marx's list.
IX. I must code for at least six hours in total.
X. If I cannot complete all tasks in time, I still have to present an unofficial development version to Marx which compiles, doesn't immediately crash and contains all the work I have completed.
XI. If I do complete all tasks, I will correct bugs and such the rest of the time.
XII. After that, Marx praises me with words "A True Communist art thou, holybanana! May the Party achieve great glory under thy command!"
XIII. Marx is now a common mortal again and I am the boss.
XIV. This means I can remove any of the features I have coded, for instance if Marx has ordered me to code a striptease AI for Raxy.
XV. Otherwise the features will be present in the next official version.
XVI. Note that there is one coding exercise in the appendix of lecture II. This one is optional, since some people have no programming experience. But if the winner doesn't solve it, he will only be called Engels and can command me for but five hours.


Here's the current list of exercises, details are found in the lectures:

Lecture II: Adding a hostile Sherarax to New Attnam and beating her with custom equipment only.
Appendix of lecture II, the coding exercise: Summoning a holy banana from the wait command.
Lecture III: Finding out which script commands order the generation of certain potions.
Lecture IV, exercise I: Adding a random amount of bananas to the player inventory at the start of the game. The amount must obey certain rules.
Lecture IV, exercise II: Is there any way to have an item appear one time in ten thousand games in a specific place, using just the script?

Lecture V will add either one or two tasks.

Freelance Berzerker has already completed the first task. He is not required to do it again, but others are still obliged to complete it.

Edit: I now added lecture V: Adding materials. The race is now on. I also taught you an important lesson about socialist systems: Deadlines are always met in them.

The final exercise is to add an ommel nut flesh material. An easy task.


Last edited by holybanana on Wed Sep 06, 2006 2:48 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
blob
elder dark mage


Joined: 28 Mar 2005
Posts: 999
Location: Idling in AFK-land

PostPosted: Tue Sep 05, 2006 10:07 am    Post subject: Reply with quote

hahaha ! This is such a damn good idea! Its evil. I was far too lazy to start coding in the same as my training course as drawing for ivan already takes 100% of my freetime but i ll look that this evening. Even though i dont even understand what i have to do for some of the exercises >_>

Man, there's so funny stuff that could be added for ivan huhuhu...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Battleguy01
gibberling


Joined: 27 Jun 2006
Posts: 156
Location: I bet you want to know where I am, but i'm not going to tell you!

PostPosted: Tue Sep 05, 2006 10:53 pm    Post subject: Reply with quote

Does anyone know any good programs for taking screenshots?
Back to top
View user's profile Send private message
blob
elder dark mage


Joined: 28 Mar 2005
Posts: 999
Location: Idling in AFK-land

PostPosted: Tue Sep 05, 2006 10:57 pm    Post subject: Reply with quote

snapshot. free and good.

edit: why do you post that here ?!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Battleguy01
gibberling


Joined: 27 Jun 2006
Posts: 156
Location: I bet you want to know where I am, but i'm not going to tell you!

PostPosted: Tue Sep 05, 2006 11:03 pm    Post subject: Reply with quote

Because i need to take a pic of me killing raxy.

and how do i get it to show on the page?
Back to top
View user's profile Send private message
Somagu
werewolf


Joined: 01 Sep 2005
Posts: 547
Location: In AFK-Land™

PostPosted: Tue Sep 05, 2006 11:35 pm    Post subject: Reply with quote

Just use the print screen button, go into MS Paint, save it as a PNG, then host it on imageshack, and use the "Img" tags to directly link to the image.
_________________
FROG BLAST THE VENT CORE!
Do not mess with the NPSRMRNPPMASZoPawKaBfoG
[01:21] Somagu21: Jacques Flambč
[01:22] guardsheep2000: also known as the greatest firework known to man
I am not under crack. ~~Blob
Back to top
View user's profile Send private message
Freelance Berzerker
orc general


Joined: 28 Jun 2006
Posts: 805
Location: In Valhalla, currently posing as "Engels"

PostPosted: Wed Sep 06, 2006 7:47 am    Post subject: Reply with quote

I've been out for a couple days. This sounds so cool. HB, as usual, is performing a great service for all IVANers.
Back to top
View user's profile Send private message
Freelance Berzerker
orc general


Joined: 28 Jun 2006
Posts: 805
Location: In Valhalla, currently posing as "Engels"

PostPosted: Thu Sep 07, 2006 5:28 am    Post subject: Response to Questions for IVAN Script Lecture III Reply with quote

Quote:
Exercise: randomly generated orc slaughterers may carry potions of troll blood. Find out in which file this detail is defined. Present the line.

The file for this detail is in char.dat. Specifically, in the last line of the following code:

Code:

Config SLAUGHTERER;
  {
    TorsoBitmapPos = 48, 48;
    AttributeBonus = 20;
    Helmet = BRONZE helmet;
    BodyArmor = BRONZE bodyarmor(CHAIN_MAIL);
    RightWielded = IRON meleeweapon(AXE);
    LeftWielded = IRON meleeweapon(AXE);
    CWeaponSkillHits == 100;
    RightSWeaponSkillHits = 50;
    LeftSWeaponSkillHits = 50;
    NameSingular = "orc slaughterer";
    PanicLevel = 40;
    Inventory == potion { SecondaryMaterial = TROLL_BLOOD; Chance = 10; }
  }


Quote:
Then find out where it is defined that the orc general and the orc officers in the orc room of GC have some more expensive potions in their inventory. Present the lines.

This detail is contained in dungeon.dat under “Types” in the following code:

Code:

RandomLevel 6:10;
  {
    Room
    {
      Size = 9,7;
      AltarPossible = false;
      GenerateFountains = false;
      Shape = ROUND_CORNERS;

      CharacterMap
      {
        Pos = 1,1;
        Size = 7,5;

        Types
        {
          G = orc(GENERAL) { Inventory = { 2, Random { MinPrice = 100; Category = POTION; Times = 4; }, Random { MinPrice = 200; Category = POTION; Times = 2; } } }
          O = orc(OFFICER) { Inventory == Random { MinPrice = 100; Category = POTION; Times = 2; } }
          S = orc(SQUAD_LEADER);
          s = orc(SLAUGHTERER);
          o = orc;
        }
      }
      {
        .ooooo.
        osSOSso
        ossGsso
        osSOSso
        .ooooo.
      }
    }
  }
Back to top
View user's profile Send private message
Freelance Berzerker
orc general


Joined: 28 Jun 2006
Posts: 805
Location: In Valhalla, currently posing as "Engels"

PostPosted: Thu Sep 07, 2006 7:42 am    Post subject: Response to Questions for IVAN Script Lecture IV Reply with quote

Quote:

Exercise: Suppose the player's bananagrower friends give him a farewell gift at the start of each journey. That is, a random amount of bananas is generated at the start of the game in the player's inventory. One banana is always generated. Five to six bananas are most common. The maximum of ten bananas is generated only rarely. Bananagrowers are generous to their friends but ten is already a bit too much, as they have to feed their children. How do you implement this feature using just the script?


I would modify the equipment as follows:

Code:

playerkind
{
  DefaultArmStrength = 10;
  DefaultLegStrength = 10;
  DefaultDexterity = 10;
  DefaultAgility = 10;
  DefaultEndurance = 10;
  DefaultPerception = 10;
  DefaultIntelligence = 10;
  DefaultWisdom = 10;
  DefaultCharisma = 10;
  DefaultMana = 10;
  DefaultMoney = 45;
  TorsoBitmapPos = 32, 416;
  LegBitmapPos = 0, 416;
  TotalVolume = 80000;
  TotalSize = 175;
  CanRead = true;
  NameSingular = "human";
  AttachedGod = SEGES;
  DisplacePriority = 2;
  Inventory = { 10, banana {Chance = 100;} banana {Chance = 80;} banana {Chance = 70;} banana {Chance = 70;} banana {Chance = 70;} banana {Chance = 70;} banana {Chance = 5;} banana {Chance = 5;} banana {Chance = 5;} banana {Chance = 5; } }
}


Quote:
Exercise II: Is there any way to have an item appear one time in ten thousand games in a specific place, using just the script? Answer yes or no. If you answered yes, present an example.


No. This would require something just in the script which logs the number of games played, which the coder could then use to insert an item which would appear once every 10,000 times in a specific place. Currently, I see no such entry in the script.
Back to top
View user's profile Send private message
Freelance Berzerker
orc general


Joined: 28 Jun 2006
Posts: 805
Location: In Valhalla, currently posing as "Engels"

PostPosted: Thu Sep 07, 2006 8:18 am    Post subject: Response to Questions for IVAN Script Lecture V Reply with quote

Quote:
Exercise: Create an ommel nut flesh material, which spoils slowly and radiates bright yellow light. Make it so that golems can be generated of this material but it cannot be wished nor mirrored. It belongs to Nefas. Let it have the same effect and messages as ommel urine, but the effect is stronger. Let its natural form be a nut. Present the config definition.


First, I inserted OMMEL_NUT into define.dat as follows:

Code:

#define ORGANIC_ID (4096 * 2)

#define BANANA_FLESH (ORGANIC_ID + 1)
#define SCHOOL_FOOD (ORGANIC_ID + 2)
#define BANANA_PEEL (ORGANIC_ID + 3)
#define KIWI_FLESH (ORGANIC_ID + 4)
#define PINEAPPLE_FLESH (ORGANIC_ID + 5)
#define PLANT_FIBER (ORGANIC_ID + 6)
#define MUTANT_PLANT_FIBER (ORGANIC_ID + 7)
#define BONE (ORGANIC_ID + 8)
#define BREAD (ORGANIC_ID + 9)
#define HOLY_BANANA_FLESH (ORGANIC_ID + 10)
#define CARROT_FLESH (ORGANIC_ID + 11)
#define OMMEL_CERUMEN (ORGANIC_ID + 12)
#define OMMEL_BONE (ORGANIC_ID + 13)
#define OMMEL_TOOTH (ORGANIC_ID + 14)
#define OMMEL_NUT (ORGANIC_ID +15)


Next, I added OMMEL_NUT to material.dat:

Code:

  Config OMMEL_NUT;
  {
    StrengthValue = 2;
    Density = 5000;
    ConsumeType = CT_MISC_ORGANIC;
    Color = rgb16(0, 230, 0);
    Emitation = rgb24(140, 140, 100);
    NutritionValue = 1000;
    PriceModifier = 5000;
    NameStem = "ommel nut";
    ConsumeEndMessage = CEM_OMMEL;
    HitMessage = HM_OMMEL;
    Alpha = 150;
    SpoilModifier = 500000;
    AttachedGod = NEFAS;
    NaturalForm = nut;
    IntelligenceRequirement = 5;
    Effect = EFFECT_OMMEL_URINE;
    ConsumeEndMessage = CEM_OMMEL_BONE;
    BodyFlags = Base|IS_WARM;
    InteractionFlags = Base|EFFECT_IS_GOOD;   
    NameFlags = Base|USE_AN;
    CategoryFlags = Base|IS_SPARKLING|IS_GOLEM_MATERIAL;
    CommonFlags = Base&~CAN_BE_MIRRORED&~CAN_BE_WISHED;   
  }
}
Back to top
View user's profile Send private message
Battleguy01
gibberling


Joined: 27 Jun 2006
Posts: 156
Location: I bet you want to know where I am, but i'm not going to tell you!

PostPosted: Thu Sep 07, 2006 8:25 am    Post subject: Reply with quote

Nice one, hope you get it.
Back to top
View user's profile Send private message
Freelance Berzerker
orc general


Joined: 28 Jun 2006
Posts: 805
Location: In Valhalla, currently posing as "Engels"

PostPosted: Thu Sep 07, 2006 8:34 am    Post subject: Reply with quote

Heh, we'll see. Since HB, isn't responding unless the code is absolutely correct, I won't know if I'm right or wrong for a couple weeks. I've test-played the game each time I added code to see if the game would crash, and haven't had any errors crop up yet. But I'm also pretty new at this. In fact, completely new at this...

Now, back to my regular work Sad
Back to top
View user's profile Send private message
mistifilio
giant mushroom


Joined: 19 Dec 2005
Posts: 6
Location: Donistan

PostPosted: Thu Sep 07, 2006 4:45 pm    Post subject: Reply with quote

Freelance,

A couple of detail errors I can see. Very Happy

in your answer to #5, you post your changed define.dat as well as the config. The challenge only asks for the config so I don't know if HB would hold it against you, but the space between the "+" and "15" is probably important.
Code:
#define OMMEL_NUT (ORGANIC_ID + 15)

Rather than
Code:
#define OMMEL_NUT (ORGANIC_ID +15)


Also in you answer to #4a, you need a comma between each banana, Chance = 100 is redundant, and esthetically match the spacing of other script elements there should be a space after "{" and before "}".
Code:
  Inventory = { 10, banana, banana { Chance = 80; }, banana { Chance = 70; }, banana { Chance = 70; }, banana { Chance = 70; }, banana { Chance = 70; }, banana { Chance = 5; }, banana { Chance = 5; }, banana { Chance = 5; }, banana { Chance = 5; } }

Rather than
Code:
  Inventory = { 10, banana {Chance = 100;} banana {Chance = 80;} banana {Chance = 70;} banana {Chance = 70;} banana {Chance = 70;} banana {Chance = 70;} banana {Chance = 5;} banana {Chance = 5;} banana {Chance = 5;} banana {Chance = 5; } }

Also your probabilities make an average of 4.8 bananas which make the most common occurances 4 and 5 rather than 5 and 6 as the assignment dictates. Using a simple binomial distribution would create 5.5 bananas on average with 2 and 10 being the least common and might be more elegant like so:
Code:
 Inventory = { 2, banana, banana { Times = 9; Chance = 50; } }



My answer to #4 II would have to be maybe. It would depend on what HB actually meant with the phrase
Quote:
an item appear one time in ten thousand games in a specific place

If "an item" rules out things inside containers because the contain would be one item and the contents would also be one item and thus would constitute 2 items, then my answer would be no.

If, however, containers are not ruled out then my answer would be yes.
Code:
Item == itemcontainer(LARGE_CHEST) { Chance = 1; itemsinside == ADAMANT OCTIRON meleeweapon(PICK_AXE) { Chance = 1; } }

Inside an ItemMap config such as the temple or a shop, or possibly on top of a specific terrain square that has to appear such as UT1 stairs down. Should generate a Large Chest 1 in 100 games and an Adamant Pickaxe with Octiron handle (assuming PICK_AXE is defined meleeweapon config...I haven't looked at how pickaxes are actually defined.) inside 1 in 100 of those chests so it should generate the pickaxe in 1 of 10,000 games.
Back to top
View user's profile Send private message
mistifilio
giant mushroom


Joined: 19 Dec 2005
Posts: 6
Location: Donistan

PostPosted: Thu Sep 07, 2006 4:59 pm    Post subject: Reply with quote

Freelance,

Also for #5 you need to add an EffectStrength value to satisfy the "make the effect stronger" qualification. Very Happy

Misti
Back to top
View user's profile Send private message
Z
wolf


Joined: 19 Jan 2005
Posts: 336

PostPosted: Thu Sep 07, 2006 6:05 pm    Post subject: Reply with quote

mistifilio wrote:
Freelance,

A couple of detail errors I can see. Very Happy

in your answer to #5, you post your changed define.dat as well as the config. The challenge only asks for the config so I don't know if HB would hold it against you, but the space between the "+" and "15" is probably important.
Code:
#define OMMEL_NUT (ORGANIC_ID + 15)

Rather than
Code:
#define OMMEL_NUT (ORGANIC_ID +15)



This is only a guess (I did not try it, I only talk from my general experience with scripts and programming languages), but I think spacing (and also usually where the lines end) is not important, and the compiler/interpreter will not care about it. Parentheses, commas and other symbols are important. However, if the script is also to be read by humans, then it is good to follow a specific style.

(Side note 1. However, if there were no parentheses, then it could lead to bugs in C, although the compiler would not complain about it --- for example, OMMEL_NUT*5 would evaluate to ORGANIC_ID +15*5, which is ORGANIC_ID+75 not (ORGANIC_ID+15)*5)

(Side note 2. I wonder why the GoogleAds has given us ads about Jesus for this topic)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ivanforum Forum Index -> Programming All times are GMT
Goto page 1, 2, 3  Next

Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group