Problems with actor.cloneindex.variable

You must understand the Game Editor concepts, before post here.

Problems with actor.cloneindex.variable

Postby sillydraco » Sat Apr 17, 2010 2:50 am

i see others here are having the same problem as i am, having trouble being more clone-specific with the script-editor function :3 atm im working on a simple program for my D&D group to help out with the many monsters and characters and keeping track of hp, initiative, and random things such as being dazed / shaken / etc and however many rounds it lasts. in the master control form, ill have it set up so you can click an up arrow button and increase the turn count, which will also decrease the counters on all the other forms (so if someone is dazed from turn 1 - 5, that will make the turn count 2 and the dazed count will become 4) so far everything works perfectly, i have the form set up and it wont be too hard to use. you can scroll left and right using the arrowkeys :3

(1)
first my problem is that i want to make that single form become 25 forms, each acting independantly. i was thinking clones, but as im sure everyone knows "actor.cloneindex.textnumber" will not work. probably because the system doesnt know if im trying to do two cloneindexes or two textnumbers or one of each. silly system! but anyway, i noticed that a Actor* function has been tossed around in other similar threads, but i just cant seem to figure out how to use it. how does this work?

(2)
i also want to make a master form, one that can reset everything, keep track of turn count, etc. that should fall into place as soon as i figure out how to do the first point.

(3)
and lastly i want to make it so that each form will be sorted in numerical order by initiative, basically each form is set up in a wire frame, while text and buttons and such are parented by the form they manage. this page here shows a pretty good way of doing that, and im sure if i got creative i could figure that out too. maybe some sort of variable that would put the form with the highest initiative in wire frame 1, the next in wire frame 2, etc. im confidant i can figure this out on my own, but any tips are appreciated :) this website here shows some good stuff to do with sorting:

http://mathbits.com/mathbits/compsci/arrays/sorting.htm




ive attatched two zip files, one has the working form but there is only one. the other zip has 25 forms (how i want it to look) but they dont work because i dont know how to do the clones yet :) and of course theres a screeny!
Attachments
screeny.png
Working DnD Organiser.zip
(225.31 KiB) Downloaded 135 times
DnD Organiser.zip
(640.81 KiB) Downloaded 131 times
Time for sleepy, dream of new things...new life, new reality, new wings.
Image
User avatar
sillydraco
 
Posts: 71
Joined: Fri Apr 03, 2009 7:54 am
Score: 3 Give a positive score

Re: Problems with actor.cloneindex.variable

Postby DST » Sat Apr 17, 2010 3:56 am

It's all stored in memory, and to get there, you have to tell the computer where to look, and what it's looking at.

Code: Select all
Actor * thisone=getclone("form.1");       //getclone transforms "form.1" into a memory pointer (in your computers ram).
thisone->textNumber=0;                        //-> is the get/assign function. thisone->var=  or var=thisone->textNumber.


with getclone, you cannot specify "1" as i, but only as a specific number.
To get a variable clonenumber, (as when you're looping thru 25 of them), use Getclone2:

grab the getclone2 script here, and Copy and paste it into your global script editor and save it.
viewtopic.php?f=5&t=711&p=3252

Code: Select all
int i;
Actor *thisone;
for(i=0; i<10; i++){
thisone=getclone2("form", i);
thisone->textNumber=0;
}
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Problems with actor.cloneindex.variable

Postby sillydraco » Sat Apr 17, 2010 4:07 am

the main problem im having here is i dont know which part of the code to change :/ i can tell that i need to put the actor's name in there somewhere, and the cloneindex but theres so many places it looks like it might go x3
Time for sleepy, dream of new things...new life, new reality, new wings.
Image
User avatar
sillydraco
 
Posts: 71
Joined: Fri Apr 03, 2009 7:54 am
Score: 3 Give a positive score

Re: Problems with actor.cloneindex.variable

Postby DST » Sat Apr 17, 2010 4:30 am

Okay here's a breakdown:

1st is declare new variables. i declared:
Actor * and named it thisone;
int and named it i

i called the getclone function, and then asked for form.1 . I used getclone2 and asked for form.i Here, i and 1 both refer to cloneindex. form is what you called your actors, whatever their name is goes there.
getclone("actorname.cloneindex");
getclone2("actorname", cloneindex);

i then simply referred to actor thisone, which is being stored in this script. it will be gone after this script finishes, but you can call it again as many times as you like.

thisone is now equal to the real actor; any changes you make to thisone also happen to the actual actor.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Problems with actor.cloneindex.variable

Postby sillydraco » Sat Apr 17, 2010 4:45 am

aha i see, i think ive got the hang of it now! its working anyway :3 now to install the rest of the code and duplicate it...hopefully it works! +1 to you ^^

EDIT: it works! ill post the final working program, with some extra stuff, in the demo section :)
Time for sleepy, dream of new things...new life, new reality, new wings.
Image
User avatar
sillydraco
 
Posts: 71
Joined: Fri Apr 03, 2009 7:54 am
Score: 3 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron