Jacquelinett Posted February 14, 2013 Author Share Posted February 14, 2013 I had been making an event system, things are fine, my code work fine, but now i stuck on a conceptual ideahow would i implement the conditional branch dynamically?I cant seem to find a good way to code it that make use efficiently of space, and having multiple if at once Link to comment Share on other sites More sharing options...
Richy420Rich Posted February 14, 2013 Share Posted February 14, 2013 You'd have to compare the event variable to determine which if statement to run, they would be an array based on the total of events allowed.eventVariable(eventNum); Pretty much.And allow your event editor to set your eventVariable(eventNum);I'm not fluent in how any other language handles but eh, basically the idea is the same. Link to comment Share on other sites More sharing options...
Jacquelinett Posted February 14, 2013 Author Share Posted February 14, 2013 > You'd have to compare the event variable to determine which if statement to run, they would be an array based on the total of events allowed.> > eventVariable(eventNum); Pretty much.> > And allow your event editor to set your eventVariable(eventNum);> > I'm not fluent in how any other language handles but eh, basically the idea is the same.I thought of that, but wouldnt it just comparing 1 statement?sayi have an int* ConditionalBranch[MapSize], if this int[locationsomewhere, the x, y coor] have the value of a nonzero, then let sayi have a function call "Execute"so likeBefore it do the stuff in event, it check the condition first.I suck at explaining thing, but i do what i planned, it only allow an if statement, and no else statementneither is else if. Link to comment Share on other sites More sharing options...
Richy420Rich Posted February 14, 2013 Share Posted February 14, 2013 That's why RPG Maker event system allows more than 1 conditional branch;So within it's programs code, it will compare the variable each time it's in the event editor.(First conditional)if variable = 1 thenelse(Second conditional)if variable = 2 thenelseend ifend ifThen when the event is saved, the variable is usually carried by a players file (or not if ran within the server) as int eventVar(eventNum)Then the inner code will check whether the code executes or not.if eventVar(eventNum) == int[locationsomewhere, the x, y coor]{Execute}End ifLol my explanation is probably 100 times worse, I'm not knowing the coding language you're working with. Link to comment Share on other sites More sharing options...
Jacquelinett Posted February 14, 2013 Author Share Posted February 14, 2013 > That's why RPG Maker event system allows more than 1 conditional branch;> > So within it's programs code, it will compare the variable each time it's in the event editor.> > (First conditional)> > if variable = 1 then> > else> > (Second conditional)> > if variable = 2 then> > else> > end if> > end if/implying i can just type in else and else and else?waiti think im beginning to see what u meani thinkim not surebut isnt what u are trying to sayis basically do what i said earlier which is to call the check function if the data isnt 0and the number that isnt zero represent a branch type, where u can compare thing?but if you have an overloaded function where u put in 2 variable, then you would compare the if and else?but what i just said make no sense Link to comment Share on other sites More sharing options...
Godlord Posted February 15, 2013 Share Posted February 15, 2013 I think function pointers are what you are looking for.Yours faithfully,S.J.R. van Schaik. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now