Jump to content

MiscObject as Array And loop "FOR" in papyrus


virginharvester

Recommended Posts

SFMBE,

after a long time i do modding skyrim again,

and I forgot how to do some basic and can't find the solution at the internet,

basically, this is the scratch script (i not test it) :

Scriptname HotkeyScript  Extends Quest

MiscObject Property GemAmethyst Auto
MiscObject Property GemAmethystFlawless Auto
MiscObject Property GemDiamond Auto
MiscObject Property GemDiamondFlawless Auto
MiscObject Property GemEmerald Auto
MiscObject Property GemEmeraldFlawless Auto
MiscObject Property GemGarnet Auto
MiscObject Property GemGarnetFlawless Auto
MiscObject Property GemRuby Auto
MiscObject Property GemRubyFlawless Auto
MiscObject Property GemSapphire Auto
MiscObject Property GemSapphireFlawless Auto

int property VarCount auto
int property Loop auto

MiscObject[] ArrayInput[6]
ArrayInput[1] = GemAmethyst
ArrayInput[2] = GemDiamond
ArrayInput[3] = GemEmerald
ArrayInput[4] = GemGarnet
ArrayInput[5] = GemRuby
ArrayInput[6] = GemSapphire

MiscObject[] ArrayOutput[6]
ArrayOutput[1] = GemAmethystFlawless
ArrayOutput[2] = GemDiamondFlawless
ArrayOutput[3] = GemEmeraldFlawless
ArrayOutput[4] = GemGarnetFlawless
ArrayOutput[5] = GemRubyFlawless
ArrayOutput[6] = GemSapphireFlawless

// register for right shift
Event OnInit()
	RegisterForKey(54)
EndEvent

// if right shift pressed
Event OnKeyDown(Int KeyCode)
	If KeyCode == 54
		For(Loop = 1, Loop <= 6, Loop++)
	  		VarCount = Game.GetPlayer().getItemCount(ArrayInput[Loop])
			Game.GetPlayer().removeItem(ArrayInput[Loop],VarCount)
			Game.GetPlayer().addItem(ArrayOutput[Loop],VarCount)
		EndFor
	EndIF
EndEvent

as you can see, the declare for Array seem wrong,

can someone show me how to declare "MiscObject" as Array object?

second thing is i cant find loop for "FOR" at internet, is "FOR" loop exist in papyrus?

of course you can correct me for other syntax or anything else,

thanks for reading

Edited by virginharvester
Link to comment
Share on other sites

I have not used Papyrus directly, but it seems like so many things, it is based upon C programming language. The for loop can be found in any website helping with C programming. An example I found on the Internet is:

#include <stdio.h>
int main()
{
   int i;
   for (i=1; i<=3; i++)
   {
       printf("%d\n", i);
   }
   return 0;
}

Now, packages like Papyrus can alter the C style, it can augment and add to it. So many programming languages are so similar it makes it very difficult for programmers to switch between them. Java is very similar. Pascal and many others use a similar style. In Pascal for example, it uses the Begin and End format for code, but C uses the braces, or curly brackets. The comment in C is the slash, but in Pascal it is the asterisk and slash. \* *\ Or is it the reverse slash? I forget. :confused:

 

So, to know the actual answer I would have to research Papyrus. I see from their web site that is seems to based upon C.

 

I hope that helps.

 

I am sorry if I remembered wrong. I have CRS (Can't Remember Stuff) 30 years in programming, but being overqualified for the jobs I applied for, I have not done programming in a while.

:ohmy:

Edited by jbarradale
Link to comment
Share on other sites

I have not used Papyrus directly, but it seems like so many things, it is based upon C programming language. The for loop can be found in any website helping with C programming. An example I found on the Internet is:

#include <stdio.h>
int main()
{
   int i;
   for (i=1; i<=3; i++)
   {
       printf("%d\n", i);
   }
   return 0;
}

Now, packages like Papyrus can alter the C style, it can augment and add to it. So many programming languages are so similar it makes it very difficult for programmers to switch between them. Java is very similar. Pascal and many others use a similar style. In Pascal for example, it uses the Begin and End format for code, but C uses the braces, or curly brackets. The comment in C is the slash, but in Pascal it is the asterisk and slash. \* *\ Or is it the reverse slash? I forget. :confused:

 

So, to know the actual answer I would have to research Papyrus. I see from their web site that is seems to based upon C.

 

I hope that helps.

 

I am sorry if I remembered wrong. I have CRS (Can't Remember Stuff) 30 years in programming, but being overqualified for the jobs I applied for, I have not done programming in a while.

:ohmy:

no, its not help me, you bring me new questions for me than the answer

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...