PDA

View Full Version : SR4 Phase 3



Fenloh
October 9th, 2008, 19:43
SR4 Ruleset 0.3 is ready for a first look. Its based on the foundations ruleset and lots of help for a newbie. Thanks again.

1. Global Woundmodifier needs to be subtracted of the Diceroll - my problem here is, that i cant get the correct number from the woundmodifierfield.
2. Activeskills, Knowledgeskills and Spells are not being sortet. I have tried to implement the sortmechanism of the inventory, but i get errors and it does not work
3. The Numberfield for the Dicechecks in the Activeskills, Knowledgeskills and Spells is not automatically summed up. The Field should be Score and Modifier of the skill/spell and the Stat for the skill added up. (the reference to the Attribute is also missing)
4. Combat Page Meleeweapons and Ranged weapons need a bit of work (Minor)
5. Anchoring on the Main Page (Minor)
6. Spells Page needs a bit work, Draincheck, Magic, Resonance, Initiation(Minor)
7. Graphiks/Skin and font need to be worked on. They are form the D20 Modern. Just for the Testing (Minor)

If anyone wants to take a look at the ruleset, pls send me a pm.

Fenloh

Fenloh
October 10th, 2008, 11:29
This whole Datanodestuff gets me annoyed. Darn.

I have a Windowclass.. say Charsheet_combat
I have generated a Template for the fieldtype (Standard).
The field is numbers only.

I can access the specific Value on this specific field. e.g. I do a onDrag i can set local variables with Value and description of the field. I can access the Modifierstack.

I now need a Value from another field.
That field is also a Standard field located in the windowsclass "Charsheet_Main".

The Questions:
1. How exactly do i store the Value and Name of the field(s)to the database?
2. How do i access those variables.

I am a bit confused, because i cant even Access the Nodenames (getNodeName() is a Nil Value) and i dont even Know how to refere to the Node variable. I tried to set a local variable.

This is how i thought to set the Value of the field to stat.body.source:
(located in the windowclass Charsheet_main)
<statscore name="body" source="stat.body.score">

This is how i tried to access the Value of the Body field from a function in the Woundfield:

function onDragblabla

local vari1 = stat.body.score

all i get is a nil Value


The data must be there though, since that code works just fine:

<statcheck name="bodycheck" source="stat.body.check">
<anchored>
<to>body</to>
<position>right</position>
<offset>45</offset>
</anchored>
<readonly />
<target>body</target>
<description>
<text>Body check</text>
</description>
<source>
<name>stat.body.score</name>
<op>+</op>
</source>
<source>
<name>stat.body.bonus</name>
<op>+</op>
</source>
</statcheck>

it adds up to the Statcheck field as i want it.


(What does <target>body</target> do anyway?)

Fenloh
October 10th, 2008, 21:53
Well i did learn a lot lately :) so there are more stupid questions coming up.


local valuewound = window.getDatabaseNode().createChild("woundmodifier", "number");
if not ModifierStack.isEmpty() then
value = value + ModifierStack.getSum();
valuemod = ModifierStack.getSum();
desc = desc .. " + Global Modifier(" .. valuemod .. ")";
end
if not valuewound or valuewound ~= 0 then
value = value - valuewound;
desc = desc .. " . Wound Modifier (" .. valuemod .. ")";
end

That is the code for Rolling the Dice. I am not sure about 2 things.
1. is it correct that i set local valuewound as stated in the code?
2. What is the correct syntax if i want to compare a local varable if it is empty or 0? (these are the times i do not want something to happen, like in the Code.

Foen
October 11th, 2008, 06:52
Hi Fenloh

There are two different object models in the FG environment: the window/control object model; and the database object model. They share some method names (eg getValue and setValue) and hence can easily be confused.

Window/Control Object Model

This is used to refer to objects rendered in a session, regardless of source.

Advantages: You can refer to things that don't have a database representation (so you can change the layout of a control, or its tool tip text, neither of which are in the DB, and you can refer to and change fields which have no DB presence, such as window titles).

Disadvantages: You can only refer to elements rendered in the current window (so you cannot access items on a different charsheet tab, for example).

Syntax: Generally a control called 'mycontrol' in a window called 'win' is referenced as win.mycontrol and its value is referenced as win.mycontrol.getValue()

Database Object Model

This is used to refer to items stored in the campaign database and in reference/adventure modules.

Advantages: This allows you to access any data in the database, even if it is not currently being displayed. The reference mechanism can be made context-insensitive, so the same code can work if invoked from different places in the ruleset.

Disadvantages: The code is more verbose.

Syntax: Nodes are accessed relative to a starting database node, say dbnode, using getChild(name) and createChild(name, type) routines, and the values accessed using getValue(). The starting node is often the one representing the current window or control, and is referenced using getDatabaseNode().

For example, if you are writing script in the contest of a window, which has a bound control called 'name', getDatabaseNode().getChild("name") will return the node bound to the 'name' control.

Navigation

Both object models present a tree structure, and there is a previous thread which compares how you navigate up and down the trees here (https://www.fantasygrounds.com/forums/showthread.php?t=7248).

Hope that makes sense,

Stuart

Foen
October 11th, 2008, 07:01
1. is it correct that i set local valuewound as stated in the code?

That is perfect if you want to guarantee that valuewound has a value (even if it is zero) regardless if woundmodifier exists or not, and it creates woundmodifier if it doesn't already exist. If you also want to check if woundmodifier exists so you can abandon processing if it doesn't exist, then you could do this:



local valuewound;
if not getDatabaseNode().getChild("woundmodifier") then
return; --[[ eg this quits the current function if there is no wound modifier ]]
end
valuewound = getDatabaseNode().getChild("woundmodifier");



2. What is the correct syntax if i want to compare a local varable if it is empty or 0? (these are the times i do not want something to happen, like in the Code.

Typically you might use the following syntax:



if var and var~=0 then
--[[ do something with var ]]
end


Hope that helps

Stuart

Fenloh
October 11th, 2008, 12:00
Thanks to Foen another Step is made. Thanks a lot for making some things clearer to me.
Success Rolls and Wound Modifier work now.

I have a problem with the size of the fields. (see picture) Strangley the same code was used for the Active Skills, but it works there just fine. I just dont find the error. Any Ideas where to look? Thats the Code to the Page:

<root version="2.0">
<windowclass name="charsheet_spells">
<placement>
<size>
<width>252</width>
<height>611</height>
</size>
</placement>
<nodelete />
<sheetdata>
<standard name="woundmodifier" source="stat.wound.modifier">
<invisible />
<tabtarget>
<next></next>
<prev></prev>
</tabtarget>
<scorefield>number</scorefield>
</standard>

<genericcontrol name="spellframe">
<bounds>15,40,480,350</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<stringcontrol>
<anchored>
<to>spellframe</to>
<position>insidetop</position>
<offset>0,11</offset>
</anchored>
<center />
<font>sheetlabel</font>
<static>Spells/Programs</static>
</stringcontrol>

<stringcontrol>
<anchored>
<to>spellframe</to>
<position>insidetopleft</position>
<offset>131,25</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Name</static>
</stringcontrol>

<stringcontrol>
<anchored>
<to>spellframe</to>
<position>insidetopleft</position>
<offset>300,25</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Attribute</static>
</stringcontrol>

<stringcontrol>
<anchored>
<to>spellframe</to>
<position>insidetopleft</position>
<offset>360,25</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Rtg.</static>
</stringcontrol>

<stringcontrol>
<anchored>
<to>spellframe</to>
<position>insidetopleft</position>
<offset>395,25</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Mod.</static>
</stringcontrol>

<stringcontrol>
<anchored>
<to>spellframe</to>
<position>insidetopleft</position>
<offset>430,25</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Check</static>
</stringcontrol>

<windowlist name="spelllist">
<anchored>
<to>spellframe</to>
<position>over</position>
<offset>-12,-40</offset>
<top>
<parent>spellframe</parent>
<offset>45</offset>
</top>
</anchored>
<datasource>.spelllist</datasource>
<class>charsheet_spellitem</class>
<allowcreate />
<allowdelete />
<script file="scripts/charsheet_spelllist.lua" />
</windowlist>

</sheetdata>
</windowclass>


<windowclass name="charsheet_spellitem">
<sheetdata>
<sizelimits>
<minimum>
<height>20</height>
</minimum>
</sizelimits>
<textlistitemvalue name="spellname">
<anchored>
<left>
<anchor>left</anchor>
<offset>10</offset>
</left>
<right>
<anchor>right</anchor>
<offset>-170</offset>
</right>
<top>
<anchor>top</anchor>
</top>
</anchored>
<stringfield>.spellname</stringfield>
<tabtarget>
<next>spellstat</next>
<prev>check</prev>
</tabtarget>
</textlistitemvalue>

<stringcontrol name="spellstat">
<anchored>
<left>
<parent>spellname</parent>
<anchor>right</anchor>
<offset>5</offset>
</left>
<top>
<anchor>top</anchor>
</top>
<size>
<width>40</width>
</size>
</anchored>
<nodelete />
<nodrag />
<script>
function setStat(value)
if value and value ~= "" then
setValue(value);
else
setValue("-");
end
end

function onClickDown(button, x, y)
window.stat.cycleStat();
end

function onInit()
setStat(nil);
end
</script>
<tabtarget>
<next>spellrating</next>
<prev>name</prev>
</tabtarget>
</stringcontrol>

<numbercontrol name="stat">
<anchored>
<to>spellstat</to>
<position>insidetopleft</position>
<offset>130,-3</offset>
<size>
<width>21</width>
<height>14</height>
</size>
</anchored>
<frame>
<name>textlinesmall</name>
<offset>0,0,0,0</offset>
</frame>
<invisible />
<displaysign />
<hideonvalue>0</hideonvalue>
<font>sheetnumbersmall</font>
<disabled />
<script>
function statUpdate()
if statnode then
setValue(statnode.getValue());
else
setValue(0);
end

window.spellcheck.update();
end

function statNameUpdate()
updateNode(statnamenode.getValue());
end

function nothing() end;

function updateNode(statname)
if statnode then
statnode.onUpdate = nothing;
statnode = nil;
end

window.spellstat.setStat(statname);

if statname and statname ~= "" then
if statname=="MAG" then
statnode = window.windowlist.window.getDatabaseNode().createC hild("magiccheck", "number");
end
if statname=="RES" then
statnode = window.windowlist.window.getDatabaseNode().createC hild("resonancecheck", "number");
end

if statnode then
statnode.onUpdate = statUpdate;
end
end

statUpdate();
end

function setStat(statname)
statnamenode.setValue(statname);
end

function cycleStat()
if statnamenode then
local cyclemap = { [""] = "MAG",
["MAG"] = "RES", ["RES"] = " ", };
local statnow = statnamenode.getValue() or "";

setStat(cyclemap[statnow]);
end
end

function onInit()
statnamenode = window.getDatabaseNode().createChild("statname", "string");

if statnamenode then
statnamenode.onUpdate = statNameUpdate;
statNameUpdate();
end
end
</script>
</numbercontrol>


<statscore name="spellrating">
<anchored>
<left>
<parent>spellstat</parent>
<anchor>right</anchor>
<offset>10</offset>
</left>
<top>
<anchor>top</anchor>
<offset>2</offset>
</top>
</anchored>
<keyeditframe>
<name>sheetfocus</name>
<offset>6,5,6,5</offset>
</keyeditframe>
<font>sheetnumbersmall</font>
<hideonvalue>0</hideonvalue>
<noreset />
<nodrag />
<script>
function onValueChanged()
window["spellcheck"].update()
end
</script>
<scorefield>.spell.score</scorefield>
<modifierfield>.spell.scoremodifier</modifierfield>
<delaykeyupdate />
<tabtarget>
<next>spellbonus</next>
<prev>spellstat</prev>
</tabtarget>
</statscore>

<statbonus name="spellbonus">
<anchored>
<left>
<parent>spellrating</parent>
<anchor>right</anchor>
<offset>5</offset>
</left>
<top>
<anchor>top</anchor>
<offset>2</offset>
</top>
</anchored>
<keyeditframe>
<name>sheetfocus</name>
<offset>6,5,6,5</offset>
</keyeditframe>
<font>sheetnumbersmall</font>
<hideonvalue>0</hideonvalue>
<noreset />
<nodrag />
<script>
function onValueChanged()
window["spellcheck"].update()
end
</script>
<scorefield>.spell.bonus</scorefield>
<modifierfield>.spell.bonusmodifier</modifierfield>
<delaykeyupdate />
<tabtarget>
<next>spellcheck</next>
<prev>spellrating</prev>
</tabtarget>
</statbonus>

<spellcheck name="spellcheck">
<anchored>
<left>
<parent>spellbonus</parent>
<anchor>right</anchor>
<offset>5</offset>
</left>
<top>
<anchor>top</anchor>
<offset>2</offset>
</top>
</anchored>
<keyeditframe>
<name>sheetfocus</name>
<offset>6,5,6,5</offset>
</keyeditframe>
<font>sheetnumbersmall</font>
<hideonvalue>0</hideonvalue>
<noreset />
<description>
<text>spell check</text>
</description>
<delaykeyupdate />
<script>
function update()
if ranknode then
setValue(ranknode.getValue()+miscnode.getValue()+w indow.stat.getValue() )
end
end

function onInit()
ranknode = window.getDatabaseNode().createChild("spellrating", "number")
miscnode = window.getDatabaseNode().createChild("spellbonus", "number")

ranknode.onUpdate = update
miscnode.onUpdate = update

update()
end
</script>
<tabtarget>
<next>spellname</next>
<prev>spellbonus</prev>
</tabtarget>
</spellcheck>
</sheetdata>
</windowclass>






</root>


And again, thanks a lot for the help in this forum.

Fenloh

Foen
October 11th, 2008, 13:08
Generally a control needs to be anchored on all four sides, or have its height/width defined.

That is, for a control's vertical layout:

top,bottom OR
top,height OR
bottom,height

And for its horizontal layout:

left,right OR
left,width OR
right,width

There are some occasions where you might leave one edge unanchored (such as not anchoring the bottom edge of a stringfield or windowlist) and that lets the control expand in that direction depending on the size of its content.

In the above code (charsheet_spellitem) the statscore "spellrating" and the statbonus "spellbonus" have only their left and top edges anchored, so their layout is undefined. It is hard to tell if that causes a problem, however, as they are based on templates and you haven't included the template code (and they are not defined in the Foundation ruleset).

Hope that helps

Stuart

Bidmaron
October 11th, 2008, 13:52
Hi Fenloh

[snip]
Database Object Model

[snip]

Advantages: This allows you to access any data in the database, even if it is not currently being displayed. The reference mechanism can be made context-insensitive, so the same code can work if invoked from different places in the ruleset.

Disadvantages: The code is more verbose and is restricted to things which have rendered in the current window.

Stuart
Stuart, I'm having trouble making these two statements fit. On the one hand, db object model reference can be made context-insensitive, but on the other it is restricted to things which have rendered in the current window. I would have expected the disadvantage to be applicable to the window method.

Thanks for all your help, as always, and I hope it's okay to intrude on the thread as I'm trying to learn.

Fenloh
October 11th, 2008, 14:51
Ok the SR4 Ruleset is now ready for some playtesting.

it has the following features:
Charsheet
Statspage
- Statchecks possible
Combat Page
-You can change the Damage and the woundmodifiers here, some rolls are possible, Weapons can be stored
Skills page
Active and Knowlegskills can be stored and skillrolls performed
Feats and Abilities page
-Feats and Abilitis can be stored (feats for Implants atm)
Inventory Page
-standard Inventory page
Spells Page
- Spells/Programs can be stored and performed

Successrolls can be made with counting the Successes and possible Glitches.

Lots of things are not implemented jet, but as time goes by i will continue to work on the mod. I do now need some input what you want and what you need.
This is only a private Projekt. It is not meant to be sold at any given time, it will only be given to private persons. If you find something that may be against a copyright please inform me, so i can take it out, only pictures are being used that were found openly in the internet.

Thanks for the help and Inspiration so far.

Foen
October 11th, 2008, 15:14
My bad, it ISN'T restricted to things in the current window. I'll edit the post ;)

Fenloh
October 12th, 2008, 22:56
Some more things are solved now.

Success rolls and glitches are being counted, some more changes in the backend, some calculations.

Fenloh

Fenloh
October 13th, 2008, 13:01
Is there anyone out there willing to create the skin for the Ruleset?

I have snatched some things from here and there, but for a finishing touch it should look a lot better and should not being picked up from somewhere. I am totaly screwed when it comes to skinjobs or graphics at all. I like that one extension, but it wont properly work.

Drek chummers, Im in need of a helping hand.

Fenloh

MrkMllr
October 13th, 2008, 15:40
I have the software and graphical know how to make it happen (I think) but I am not sure about the technical side. I am still new to FG and not quite sure what one has to do in order to skin it. Could you point me in the direction of a help document or tutorial?

Thanks!
M

Fenloh
October 13th, 2008, 15:49
Oh ja, i can do that for sure.

Actually it is really easy, you have lots of Icons and Frames, all own different graphics. They are then used within the Program. Backgrounds, fields, frames, and Icons. All of them are located in the frames and Icons subfolder of the Ruleset.

How about a short meeting in Teamspeak, then i can tell you a bit more about it?

Fenloh

Oberoten
October 13th, 2008, 16:32
Is there anyone out there willing to create the skin for the Ruleset?

I have snatched some things from here and there, but for a finishing touch it should look a lot better and should not being picked up from somewhere. I am totaly screwed when it comes to skinjobs or graphics at all. I like that one extension, but it wont properly work.

Drek chummers, Im in need of a helping hand.

Fenloh

I'd be happy to finish things up for ya. :)

What do you need?

- Obe

Fenloh
October 13th, 2008, 17:06
I have sent you an email,

tks

Fenloh